@@ -952,7 +952,8 @@ def __init__(self, controller: Any, msg: Any) -> None:
952
952
self .widgets .append (self .build_pile (snapshot , 'Current' ))
953
953
continue
954
954
elif index == 0 :
955
- self .widgets .append (self .build_pile (snapshot , 'Original' ))
955
+ self .widgets .append (self .build_pile (snapshot , 'Original' ,
956
+ 'Posted' ))
956
957
else :
957
958
self .widgets .append (self .build_pile (snapshot ))
958
959
# Add a blank line after an edit block/pile.
@@ -967,9 +968,11 @@ def __init__(self, controller: Any, msg: Any) -> None:
967
968
super ().__init__ (controller , self .widgets , 'MSG_INFO' )
968
969
969
970
def build_pile (self , snapshot : Dict [str , Any ], tag : str = '' ,
970
- ) -> Any :
971
+ author_prefix : str = 'Edited' ) -> Any :
971
972
timestamp = time .ctime (snapshot ['timestamp' ])[:- 5 ]
972
973
tag = '({} Version)' .format (tag ) if tag else ''
974
+ author = '{} by {}' .format (author_prefix ,
975
+ self .get_author (snapshot ['user_id' ]))
973
976
topic = snapshot ['topic' ]
974
977
975
978
# Add suffix to the topic if it has been edited.
@@ -983,14 +986,20 @@ def build_pile(self, snapshot: Dict[str, Any], tag: str='',
983
986
], dividechars = 2 ,
984
987
)
985
988
subheader = urwid .Columns ([
989
+ urwid .Text (('edit_author' , author )),
986
990
# 18 = max(len(tag)); len('(Original Version)').
987
- (18 , urwid .Text (('edit_tag' , tag ))),
991
+ (18 , urwid .Text (('edit_tag' , tag ), align = 'right' )),
988
992
], dividechars = 2 ,
989
993
)
990
994
message = urwid .Text (snapshot ['content' ])
991
995
return urwid .Pile ([urwid .AttrWrap (header , 'popup_contrast' ), subheader ,
992
996
message ])
993
997
998
+ def get_author (self , user_id : int ) -> str :
999
+ user_email = self .controller .model .user_id_email_dict [user_id ]
1000
+ full_name = self .controller .model .user_dict [user_email ]['full_name' ]
1001
+ return full_name
1002
+
994
1003
def keypress (self , size : urwid_Size , key : str ) -> str :
995
1004
if (is_command_key ('GO_BACK' , key )
996
1005
or is_command_key ('EDIT_HISTORY' , key )):
0 commit comments