Skip to content

Commit 37b637c

Browse files
committed
views: Extend author_prefix to indicate changes in edit history.
This extends author_prefix to increase verbosity by indicating the changes that were made in any version (e.g. Content, Topic, Content & Topic). The implementation adds a workaround to spot a false alarm for content or topic change (A NOTE comment has been added). Moreover, an author_prefix, 'Edited but no changes made', has been added for edits that do not have any changes.
1 parent f830ed4 commit 37b637c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

zulipterminal/ui_tools/views.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,20 @@ def edit_block(self, snapshot: Dict[str, Any], state: str) -> Any:
10181018

10191019
tag = '({} Version)'.format(state) if state else ''
10201020

1021-
author_prefix = 'Posted' if state == 'Original' else 'Edited'
1021+
# NOTE: The false alarm bit in the subsequent code block is a
1022+
# workaround for the inconsistency in the message history.
1023+
false_alarm_content = content == snapshot.get('prev_content')
1024+
false_alarm_topic = topic == snapshot.get('prev_topic')
1025+
if ('prev_topic' in snapshot and 'prev_content' in snapshot
1026+
and not(false_alarm_content or false_alarm_topic)):
1027+
author_prefix = 'Content & Topic edited'
1028+
elif 'prev_content' in snapshot and not false_alarm_content:
1029+
author_prefix = 'Content edited'
1030+
elif 'prev_topic' in snapshot and not false_alarm_topic:
1031+
author_prefix = 'Topic edited'
1032+
else:
1033+
author_prefix = 'Edited but no changes made'
1034+
author_prefix = 'Posted' if state == 'Original' else author_prefix
10221035
author = '{} by {}'.format(author_prefix,
10231036
self.get_author(snapshot['user_id']))
10241037

0 commit comments

Comments
 (0)