diff options
author | Josip Janzic <josip@jjanzic.com> | 2018-10-16 22:03:37 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-10-22 19:40:52 +0200 |
commit | bfd5fbb9595d63510614adf897c33c945d0c0fe3 (patch) | |
tree | 3e7b0e02d5c9e8b7f59ffb8af2359aa454049ca7 | |
parent | dd1fed42794362eebb87d75ca0bf2a05170d5406 (diff) | |
download | wee-slack-bfd5fbb9595d63510614adf897c33c945d0c0fe3.tar.gz |
Fix loading history with deleted attachment
Closes #640
-rw-r--r-- | wee_slack.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py index b871219..4857cfa 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3018,8 +3018,16 @@ def unwrap_attachments(message_json, text_before): def unwrap_files(message_json, text_before): - files_texts = ['{} ({})'.format(f['url_private'], f['title']) - for f in message_json.get('files', [])] + files_texts = [] + for f in message_json.get('files', []): + if f.get('mode', '') != 'tombstone': + text = '{} ({})'.format(f['url_private'], f['title']) + else: + text = '{}(This file was deleted.){}'.format( + w.color("red"), + w.color("reset")) + files_texts.append(text) + if text_before: files_texts.insert(0, '') return "\n".join(files_texts) |