mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Fixed bug #1091927, Topic.insert was doing the same thing as Topic.add.
This commit is contained in:
parent
6002089619
commit
11c12e9062
@ -201,28 +201,28 @@ class Topic(callbacks.Privmsg):
|
|||||||
irc.reply(topic)
|
irc.reply(topic)
|
||||||
topic = wrap(topic, ['inChannel'])
|
topic = wrap(topic, ['inChannel'])
|
||||||
|
|
||||||
def add(self, irc, msg, args, channel, topic, insert=False):
|
def add(self, irc, msg, args, channel, topic):
|
||||||
"""[<channel>] <topic>
|
"""[<channel>] <topic>
|
||||||
|
|
||||||
Adds <topic> to the topics for <channel>. <channel> is only necessary
|
Adds <topic> to the topics for <channel>. <channel> is only necessary
|
||||||
if the message isn't sent in the channel itself.
|
if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
||||||
if insert:
|
|
||||||
topics.insert(0, topic)
|
|
||||||
else:
|
|
||||||
topics.append(topic)
|
topics.append(topic)
|
||||||
self._sendTopics(irc, channel, topics)
|
self._sendTopics(irc, channel, topics)
|
||||||
add = wrap(add, ['canChangeTopic', rest('topic')])
|
add = wrap(add, ['canChangeTopic', rest('topic')])
|
||||||
|
|
||||||
def insert(self, irc, msg, args):
|
def insert(self, irc, msg, args, channel, topic):
|
||||||
"""[<channel>] <topic>
|
"""[<channel>] <topic>
|
||||||
|
|
||||||
Adds <topic> to the topics for <channel> at the beginning of the topics
|
Adds <topic> to the topics for <channel> at the beginning of the topics
|
||||||
currently on <channel>. <channel> is only necessary if the message
|
currently on <channel>. <channel> is only necessary if the message
|
||||||
isn't sent in the channel itself.
|
isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
self.add(irc, msg, args, insert=True)
|
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
||||||
|
topics.insert(0, topic)
|
||||||
|
self._sendTopics(irc, channel, topics)
|
||||||
|
insert = wrap(insert, ['canChangeTopic', rest('topic')])
|
||||||
|
|
||||||
def shuffle(self, irc, msg, args, channel):
|
def shuffle(self, irc, msg, args, channel):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
@ -61,6 +61,12 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertEqual(m.args[0], self.channel)
|
self.assertEqual(m.args[0], self.channel)
|
||||||
self.assertEqual(m.args[1], 'foo (test) || bar (test)')
|
self.assertEqual(m.args[1], 'foo (test) || bar (test)')
|
||||||
|
|
||||||
|
def testInsert(self):
|
||||||
|
m = self.getMsg('topic add foo')
|
||||||
|
self.assertEqual(m.args[1], 'foo (test)')
|
||||||
|
m = self.getMsg('topic insert bar')
|
||||||
|
self.assertEqual(m.args[1], 'bar (test) || foo (test)')
|
||||||
|
|
||||||
def testChange(self):
|
def testChange(self):
|
||||||
_ = self.getMsg('topic add foo')
|
_ = self.getMsg('topic add foo')
|
||||||
_ = self.getMsg('topic add bar')
|
_ = self.getMsg('topic add bar')
|
||||||
|
Loading…
Reference in New Issue
Block a user