mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fixed bug #807245, changetopic reorders topics.
This commit is contained in:
parent
7719b8dad3
commit
9ed2dcbc31
@ -175,6 +175,8 @@ class Topic(callbacks.Privmsg):
|
||||
irc.error(msg, 'You can only modify your own topics.')
|
||||
return
|
||||
newTopic = self.topicFormatter % (replacer(topic), name)
|
||||
if number < 0:
|
||||
number = len(topics)+1+number
|
||||
topics.insert(number, newTopic)
|
||||
newTopic = self.topicSeparator.join(topics)
|
||||
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
||||
|
@ -44,6 +44,21 @@ class TopicTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertEqual(m.command, 'TOPIC')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
|
||||
def testChangetopic(self):
|
||||
_ = self.getMsg('join #foo')
|
||||
_ = self.getMsg(' ')
|
||||
_ = self.getMsg('addtopic #foo foo')
|
||||
_ = self.getMsg('addtopic #foo bar')
|
||||
_ = self.getMsg('addtopic #foo baz')
|
||||
self.assertRegexp('changetopic #foo -1 s/baz/biff/',
|
||||
r'foo.*bar.*biff')
|
||||
self.assertRegexp('changetopic #foo 1 s/bar/baz/',
|
||||
r'foo.*baz.*biff')
|
||||
self.assertRegexp('changetopic #foo 0 s/foo/bar/',
|
||||
r'bar.*baz.*biff')
|
||||
self.assertRegexp('changetopic #foo -2 s/baz/bazz/',
|
||||
r'bar.*bazz.*biff')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user