@@ -2001,33 +2001,57 @@ 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." ),
2008
+ "\n \n PLEASE TRY AGAIN LATER" ,
2009
+ ]
2010
+ max_cols = 50
2011
+ elif response == "unsupported_ZFL" :
2012
+ response = [
2013
+ (
2014
+ "msg_bold" ,
2015
+ """
2016
+ YOUR CURRENT ZT VERSION DOESN'T SUPPORT VIEWING READ RECEIPTS.
2017
+ """ ,
2018
+ ),
2019
+ "\n \n PLEASE UPDATE AND TRY AGAIN LATER" ,
2020
+ ]
2021
+ max_cols = 70
2022
+
2023
+ body_list = [urwid .Text (response )]
2024
+
2025
+ super ().__init__ (
2026
+ controller ,
2027
+ body_list ,
2028
+ "MSG_INFO" ,
2029
+ max_cols ,
2030
+ title ,
2031
+ )
2032
+ else :
2033
+ user_names = [controller .model .user_name_from_id (id ) for id in response ]
2034
+ sorted_user_names = sorted (user_names )
2035
+ msg_read_list = [("" , [(name , "" ) for name in sorted_user_names ])]
2036
+ msg_read_list .insert (
2037
+ 0 ,
2012
2038
(
2013
- "msg_bold" ,
2014
- "YOUR CURRENT ZT VERSION DOESN'T SUPPORT VIEWING READ RECEIPTS. " ,
2039
+ "" ,
2040
+ [
2041
+ (
2042
+ f"This message has been read by { len (user_names )} people." ,
2043
+ "" ,
2044
+ ),
2045
+ ("" , "" ),
2046
+ ],
2015
2047
),
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 )]
2048
+ )
2049
+ popup_width , column_width = self .calculate_table_widths (
2050
+ msg_read_list , len (title )
2051
+ )
2052
+ widgets = self .make_table_with_categories (msg_read_list , column_width )
2023
2053
2024
- super ().__init__ (
2025
- controller ,
2026
- body_list ,
2027
- "MSG_INFO" ,
2028
- max_cols ,
2029
- title ,
2030
- )
2054
+ super ().__init__ (controller , widgets , "MSG_INFO" , popup_width , title )
2031
2055
2032
2056
def keypress (self , size : urwid_Size , key : str ) -> str :
2033
2057
if is_command_key ("GO_BACK" , key ) or is_command_key ("READ_RECEIPTS" , key ):
0 commit comments