diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2018-08-19 21:30:12 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-08-20 00:43:08 +0200 |
commit | c0419e6a95552fcb8e0e4c5f42360f6cd0de706e (patch) | |
tree | b84484de4bb685b3ab15a529e84a6a4b2c83618d /wee_slack.py | |
parent | 51c2e769de9b76fc8ca6ed413cee77f878ffbcf7 (diff) | |
download | wee-slack-c0419e6a95552fcb8e0e4c5f42360f6cd0de706e.tar.gz |
Don't render messages surrounded by _ as actions
Even though me_messages and messages surrounded by underlines render
equally in the official client, it is two different types of messages.
Converting messages surrounded by underlines to me_messages causes
problems when editing, because the underlines will be removed from the
message so it won't be shown as an action anymore.
The official clients sends me_messages as that subtype, and after the
previous commit, wee-slack also does this, so there is no reason for
this conversion anymore.
Since subtype isn't changed in SlackMessage anymore, we can use the
subtype variable we have, and the comment is not needed anymore.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/wee_slack.py b/wee_slack.py index 3078827..14b7964 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2108,10 +2108,6 @@ class SlackMessage(object): senders = self.get_sender() self.sender, self.sender_plain = senders[0], senders[1] self.ts = SlackTS(message_json['ts']) - text = self.message_json.get('text') - if text and text.startswith('_') and text.endswith('_') and 'subtype' not in message_json: - message_json['text'] = text[1:-1] - message_json['subtype'] = 'me_message' def __hash__(self): return hash(self.ts) @@ -2518,10 +2514,7 @@ def process_message(message_json, eventrouter, store=True, **kwargs): dbg("Rendered message: %s" % text) dbg("Sender: %s (%s)" % (message.sender, message.sender_plain)) - # Handle actions (/me). - # We don't use `subtype` here because creating the SlackMessage may - # have changed the subtype based on the detected message contents. - if message.message_json.get('subtype') == 'me_message': + if subtype == 'me_message': try: channel.unread_count_display += 1 except: |