@@ -2001,33 +2001,55 @@ def __init__(
2001
2001
2002
2002
# Get read receipt user ids list
2003
2003
response = controller .model .fetch_read_receipts (message ["id" ])
2004
- if response is None :
2005
- response = [
2006
- ("msg_bold" , "RESPONSE CANNOT BE FETCHED AT THE MOMENT. " ),
2007
- "\n \n PLEASE TRY AGAIN LATER" ,
2008
- ]
2009
- max_cols = 50
2010
- elif response == "unsupported_ZFL" :
2011
- response = [
2004
+ if response is None or response == "unsupported_ZFL" :
2005
+ if response is None :
2006
+ response = [
2007
+ ("msg_bold" , "RESPONSE CANNOT BE FETCHED AT THE MOMENT.\n \n " ),
2008
+ (None , "PLEASE TRY AGAIN LATER" ),
2009
+ ]
2010
+ max_cols = 50
2011
+ elif response == "unsupported_ZFL" :
2012
+ response = [
2013
+ (
2014
+ "msg_bold" ,
2015
+ "YOUR ZT VERSION DOESN'T SUPPORT VIEWING READ RECEIPTS.\n \n " ,
2016
+ ),
2017
+ (None , "PLEASE UPDATE AND TRY AGAIN LATER" ),
2018
+ ]
2019
+ max_cols = 69
2020
+
2021
+ body_list = [urwid .Text (response , "center" , "space" )]
2022
+
2023
+ super ().__init__ (
2024
+ controller ,
2025
+ body_list ,
2026
+ "MSG_INFO" ,
2027
+ max_cols ,
2028
+ title ,
2029
+ )
2030
+ else :
2031
+ user_names = [controller .model .user_name_from_id (id ) for id in response ]
2032
+ sorted_user_names = sorted (user_names )
2033
+ msg_read_list = [("" , [(name , "" ) for name in sorted_user_names ])]
2034
+ msg_read_list .insert (
2035
+ 0 ,
2012
2036
(
2013
- "msg_bold" ,
2014
- "YOUR CURRENT ZT VERSION DOESN'T SUPPORT VIEWING READ RECEIPTS. " ,
2037
+ "" ,
2038
+ [
2039
+ (
2040
+ f"This message has been read by { len (user_names )} people." ,
2041
+ "" ,
2042
+ ),
2043
+ ("" , "" ),
2044
+ ],
2015
2045
),
2016
- "\n \n PLEASE UPDATE AND TRY AGAIN LATER" ,
2017
- ]
2018
- max_cols = 70
2019
- else :
2020
- response = str (list (map (controller .model .user_name_from_id , response )))
2021
-
2022
- body_list = [urwid .Text (response )]
2046
+ )
2047
+ popup_width , column_width = self .calculate_table_widths (
2048
+ msg_read_list , len (title )
2049
+ )
2050
+ widgets = self .make_table_with_categories (msg_read_list , column_width )
2023
2051
2024
- super ().__init__ (
2025
- controller ,
2026
- body_list ,
2027
- "MSG_INFO" ,
2028
- max_cols ,
2029
- title ,
2030
- )
2052
+ super ().__init__ (controller , widgets , "MSG_INFO" , popup_width , title )
2031
2053
2032
2054
def keypress (self , size : urwid_Size , key : str ) -> str :
2033
2055
if is_command_key ("GO_BACK" , key ) or is_command_key ("READ_RECEIPTS" , key ):
0 commit comments