@@ -1345,7 +1345,8 @@ def __init__(self, controller: Any, title: str, message: Message
1345
1345
self .controller = controller
1346
1346
self .message = message
1347
1347
widgets = [urwid .CheckBox (reaction ['emoji_name' ], state = True ,
1348
- checked_symbol = '✓' )
1348
+ checked_symbol = '✓' ,
1349
+ on_state_change = self .remove_reaction )
1349
1350
for reaction in message ['reactions' ]
1350
1351
if (controller .model .user_has_reacted_to_msg (
1351
1352
reaction ['emoji_name' ], message ,
@@ -1359,6 +1360,16 @@ def keypress(self, size: urwid_Size, key: str) -> str:
1359
1360
self .controller .show_emoji_picker (self .message )
1360
1361
return super ().keypress (size , key )
1361
1362
1363
+ def remove_reaction (self , checkbox : Any , state : bool ) -> None :
1364
+ if not state :
1365
+ self .controller .model .react_to_message (self .message ,
1366
+ checkbox .get_label ())
1367
+ check_boxes = self .contents ['body' ][0 ].body
1368
+ check_boxes .remove (checkbox )
1369
+ removed_check_boxes = urwid .ListBox (
1370
+ urwid .SimpleFocusListWalker (check_boxes ))
1371
+ self .contents ['body' ] = (removed_check_boxes , None )
1372
+
1362
1373
1363
1374
class EmojiPickerView (PopUpView ):
1364
1375
def __init__ (self , controller : Any , title : str , emoji_names : List [str ],
0 commit comments