Merge pull request #1078 from GLolol/channel/allow-devoice-self

Channel: allow devoicing self
This commit is contained in:
Valentin Lorentz 2015-03-16 23:19:20 +01:00
commit 381e514b5c
2 changed files with 5 additions and 5 deletions

View File

@ -259,10 +259,6 @@ class Channel(callbacks.Plugin):
the nicks given. If no nicks are given, removes voice from the person
sending the message.
"""
if irc.nick in nicks:
irc.error(_('I cowardly refuse to devoice myself. If you really '
'want me devoiced, tell me to op you and then devoice '
'me yourself.'), Raise=True)
self._voice(irc, msg, args, channel, nicks, ircmsgs.devoices)
devoice = wrap(devoice, ['channel', ('haveOp', 'devoice someone'),
any('nickInChannel')])

View File

@ -103,9 +103,13 @@ class ChannelTestCase(ChannelPluginTestCase):
self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick))
def testWontDeItself(self):
for s in 'deop dehalfop devoice'.split():
for s in 'deop dehalfop'.split():
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
self.assertError('%s %s' % (s, self.nick))
def testCanDevoiceSelf(self):
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
self.assertNotError('devoice %s' % self.nick)
def testOp(self):
self.assertError('op')