diff options
author | Tomas Janousek <tomi@nomi.cz> | 2019-01-15 13:15:33 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-01-26 11:30:58 +0100 |
commit | 507b9618f93bc864fe4516f7acf7e846e90da6b5 (patch) | |
tree | c7db1b0cb9d98697dc59470d366385518a86ef4a /wee_slack.py | |
parent | 4b7a6424054f2378c8db44fcc028d48f763c2d3f (diff) | |
download | wee-slack-507b9618f93bc864fe4516f7acf7e846e90da6b5.tar.gz |
Fix 'wrong arguments for function "buffer_set"'
When a "channel_joined" event is received (e.g. when joining channels
from the web client, or when someone else makes you join the channel),
update_from_message_json sets self.topic to the dict, but render_topic
expects it to be a string. This is an inconsistency introduced by
e64293b41573b5caad2ebf343d9a4397cef22a67. Let's keep the dict.
Actually, using update_from_message_json at all seems like a bad idea...
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/wee_slack.py b/wee_slack.py index 3026198..35b33c1 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1373,7 +1373,7 @@ class SlackChannel(SlackChannelCommon): self.eventrouter = eventrouter self.slack_name = kwargs["name"] self.slack_purpose = kwargs.get("purpose", {"value": ""}) - self.topic = kwargs.get("topic", {}).get("value", "") + self.topic = kwargs.get("topic", {"value": ""}) self.identifier = kwargs["id"] self.last_read = SlackTS(kwargs.get("last_read", SlackTS())) self.channel_buffer = None @@ -1458,14 +1458,13 @@ class SlackChannel(SlackChannelCommon): def render_topic(self): if self.channel_buffer: - if self.topic != "": - topic = self.topic - else: + topic = self.topic['value'] + if topic == "": topic = self.slack_purpose['value'] w.buffer_set(self.channel_buffer, "title", topic) def set_topic(self, value): - self.topic = value + self.topic = {"value": value} self.render_topic() def update_from_message_json(self, message_json): @@ -1806,7 +1805,7 @@ class SlackDMChannel(SlackChannel): self.update_color() self.set_name(self.slack_name) if dmuser in users: - self.topic = create_user_status_string(users[dmuser].profile) + self.set_topic(create_user_status_string(users[dmuser].profile)) def set_related_server(self, team): super(SlackDMChannel, self).set_related_server(team) |