@@ -984,7 +984,8 @@ def __init__(self, controller: Any, msg: Any) -> None:
984
984
self .widgets .append (self .build_pile (snapshot , 'Current' ))
985
985
continue
986
986
elif index == 0 :
987
- self .widgets .append (self .build_pile (snapshot , 'Original' ))
987
+ self .widgets .append (self .build_pile (snapshot , 'Original' ,
988
+ 'Posted' ))
988
989
else :
989
990
self .widgets .append (self .build_pile (snapshot ))
990
991
# Add a blank line after an edit block/pile.
@@ -999,9 +1000,11 @@ def __init__(self, controller: Any, msg: Any) -> None:
999
1000
super ().__init__ (controller , self .widgets , 'MSG_INFO' )
1000
1001
1001
1002
def build_pile (self , snapshot : Dict [str , Any ], tag : str = '' ,
1002
- ) -> Any :
1003
+ author_prefix : str = 'Edited' ) -> Any :
1003
1004
timestamp = time .ctime (snapshot ['timestamp' ])[:- 5 ]
1004
1005
tag = '({} Version)' .format (tag ) if tag else ''
1006
+ author = '{} by {}' .format (author_prefix ,
1007
+ self .get_author (snapshot ['user_id' ]))
1005
1008
topic = snapshot ['topic' ]
1006
1009
1007
1010
# Add suffix to the topic if it has been edited.
@@ -1015,14 +1018,20 @@ def build_pile(self, snapshot: Dict[str, Any], tag: str='',
1015
1018
], dividechars = 2 ,
1016
1019
)
1017
1020
subheader = urwid .Columns ([
1021
+ urwid .Text (('edit_author' , author )),
1018
1022
# 18 = max(len(tag)); len('(Original Version)').
1019
- (18 , urwid .Text (('edit_tag' , tag ))),
1023
+ (18 , urwid .Text (('edit_tag' , tag ), align = 'right' )),
1020
1024
], dividechars = 2 ,
1021
1025
)
1022
1026
message = urwid .Text (snapshot ['content' ])
1023
1027
return urwid .Pile ([urwid .AttrWrap (header , 'popup_contrast' ), subheader ,
1024
1028
message ])
1025
1029
1030
+ def get_author (self , user_id : int ) -> str :
1031
+ user_email = self .controller .model .user_id_email_dict [user_id ]
1032
+ full_name = self .controller .model .user_dict [user_email ]['full_name' ]
1033
+ return full_name
1034
+
1026
1035
def keypress (self , size : urwid_Size , key : str ) -> str :
1027
1036
if (is_command_key ('GO_BACK' , key )
1028
1037
or is_command_key ('EDIT_HISTORY' , key )):
0 commit comments