File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 4343 MarkdownHelpView ,
4444 MsgInfoView ,
4545 NoticeView ,
46+ PollResultsView ,
4647 PopUpConfirmationView ,
4748 StreamInfoView ,
4849 StreamMembersView ,
@@ -281,6 +282,34 @@ def show_msg_info(
281282 )
282283 self .show_pop_up (msg_info_view , "area:msg" )
283284
285+ def show_poll_vote (
286+ self ,
287+ poll_question : str ,
288+ options : Dict [str , Dict [str , Any ]],
289+ ) -> None :
290+ options_with_names = {}
291+ for option_key , option_data in options .items ():
292+ option_text = option_data ["option" ]
293+ voter_ids = option_data ["votes" ]
294+
295+ voter_names = []
296+ for voter_id in voter_ids :
297+ voter_names .append (self .model .user_name_from_id (voter_id ))
298+
299+ options_with_names [option_key ] = {
300+ "option" : option_text ,
301+ "votes" : voter_names if voter_names else [],
302+ }
303+
304+ self .show_pop_up (
305+ PollResultsView (
306+ self ,
307+ poll_question ,
308+ options_with_names ,
309+ ),
310+ "area:msg" ,
311+ )
312+
284313 def show_emoji_picker (self , message : Message ) -> None :
285314 all_emoji_units = [
286315 (emoji_name , emoji ["code" ], emoji ["aliases" ])
You can’t perform that action at this time.
0 commit comments