diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2018-08-17 00:28:58 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-08-17 00:30:45 +0200 |
commit | 66722bf4514bc53b12cfaa13a8c7a15d1b268cce (patch) | |
tree | dc9edaf12411e75c1fbae3f1838a2dca0229fd97 | |
parent | d8a0070228a08d67325cb36d5586097541d1f5a8 (diff) | |
download | wee-slack-66722bf4514bc53b12cfaa13a8c7a15d1b268cce.tar.gz |
Update message_json when message is changed
This fixes an issue introduced in commit d7b26dd where (edited) would
not show up after changed messages.
-rw-r--r-- | wee_slack.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index 91b2401..e62e215 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1483,10 +1483,12 @@ class SlackChannel(object): del self.hashed_messages[message_hash] self.messages = OrderedDict(messages_to_keep) - def change_message(self, ts, text=None): + def change_message(self, ts, message_json=None, text=None): ts = SlackTS(ts) if ts in self.messages: m = self.messages[ts] + if message_json: + m.message_json.update(message_json) if text: m.change_text(text) text = m.render(force=True) @@ -2590,10 +2592,10 @@ def subprocess_message_replied(message_json, eventrouter, channel, team): def subprocess_message_changed(message_json, eventrouter, channel, team): new_message = message_json.get("message", None) - channel.change_message(new_message["ts"], new_message["text"]) + channel.change_message(new_message["ts"], message_json=new_message) def subprocess_message_deleted(message_json, eventrouter, channel, team): - channel.change_message(message_json["deleted_ts"], "(deleted)") + channel.change_message(message_json["deleted_ts"], text="(deleted)") def subprocess_channel_topic(message_json, eventrouter, channel, team): |