mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 18:44:04 +01:00
plugins/Topic: Fix a bug with Topic.set where setting topic 1 would set the entire topic.
This commit is contained in:
parent
e4242ba994
commit
d5653077d3
@ -315,14 +315,14 @@ class Topic(callbacks.Plugin):
|
|||||||
sets the entire topic. <channel> is only necessary if the message
|
sets the entire topic. <channel> is only necessary if the message
|
||||||
isn't sent in the channel itself.
|
isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
if number:
|
if number is not None:
|
||||||
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
||||||
topics[number] = topic
|
topics[number] = topic
|
||||||
else:
|
else:
|
||||||
topics = [topic]
|
topics = [topic]
|
||||||
self._sendTopics(irc, channel, topics)
|
self._sendTopics(irc, channel, topics)
|
||||||
set = wrap(set, ['canChangeTopic',
|
set = wrap(set, ['canChangeTopic',
|
||||||
optional('topicNumber', 0),
|
optional('topicNumber'),
|
||||||
rest(('topic', False))])
|
rest(('topic', False))])
|
||||||
|
|
||||||
def remove(self, irc, msg, args, channel, number):
|
def remove(self, irc, msg, args, channel, number):
|
||||||
|
@ -132,6 +132,8 @@ class TopicTestCase(ChannelPluginTestCase):
|
|||||||
self.assertRegexp('topic set -1 bar', 'bar')
|
self.assertRegexp('topic set -1 bar', 'bar')
|
||||||
self.assertNotRegexp('topic set -1 baz', 'bar')
|
self.assertNotRegexp('topic set -1 baz', 'bar')
|
||||||
self.assertResponse('topic set foo bar baz', 'foo bar baz')
|
self.assertResponse('topic set foo bar baz', 'foo bar baz')
|
||||||
|
# Catch a bug we had where setting topic 1 would reset the whole topic
|
||||||
|
self.assertNotResponse('topic set 1 bar', 'bar')
|
||||||
|
|
||||||
def testUndo(self):
|
def testUndo(self):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user