mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	user_topics_ui: Convert module to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							c50b28610c
						
					
				
				
					commit
					a41d0b16e6
				
			| @@ -284,7 +284,7 @@ EXEMPT_FILES = make_set( | |||||||
|         "web/src/user_status_ui.ts", |         "web/src/user_status_ui.ts", | ||||||
|         "web/src/user_topic_popover.js", |         "web/src/user_topic_popover.js", | ||||||
|         "web/src/user_topics.ts", |         "web/src/user_topics.ts", | ||||||
|         "web/src/user_topics_ui.js", |         "web/src/user_topics_ui.ts", | ||||||
|         "web/src/views_util.ts", |         "web/src/views_util.ts", | ||||||
|         "web/src/zcommand.ts", |         "web/src/zcommand.ts", | ||||||
|         "web/src/zform.js", |         "web/src/zform.js", | ||||||
|   | |||||||
| @@ -45,6 +45,7 @@ export type MessageList = { | |||||||
|     can_mark_messages_read: () => boolean; |     can_mark_messages_read: () => boolean; | ||||||
|     can_mark_messages_read_without_setting: () => boolean; |     can_mark_messages_read_without_setting: () => boolean; | ||||||
|     rerender_view: () => void; |     rerender_view: () => void; | ||||||
|  |     update_muting_and_rerender: () => void; | ||||||
|     prevent_reading: () => void; |     prevent_reading: () => void; | ||||||
|     resume_reading: () => void; |     resume_reading: () => void; | ||||||
|     data: MessageListData; |     data: MessageListData; | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ import * as timerender from "./timerender"; | |||||||
| import * as ui_report from "./ui_report"; | import * as ui_report from "./ui_report"; | ||||||
| import {get_time_from_date_muted} from "./util"; | import {get_time_from_date_muted} from "./util"; | ||||||
|  |  | ||||||
| type ServerUserTopic = z.infer<typeof user_topic_schema>; | export type ServerUserTopic = z.infer<typeof user_topic_schema>; | ||||||
|  |  | ||||||
| export type UserTopic = { | export type UserTopic = { | ||||||
|     stream_id: number; |     stream_id: number; | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| import $ from "jquery"; | import $ from "jquery"; | ||||||
| 
 | 
 | ||||||
| import * as message_lists from "./message_lists"; | import * as message_lists from "./message_lists"; | ||||||
|  | import type {Message} from "./message_store"; | ||||||
| import * as overlays from "./overlays"; | import * as overlays from "./overlays"; | ||||||
| import * as popover_menus from "./popover_menus"; | import * as popover_menus from "./popover_menus"; | ||||||
| import * as recent_view_ui from "./recent_view_ui"; | import * as recent_view_ui from "./recent_view_ui"; | ||||||
| @@ -9,8 +10,9 @@ import * as stream_list from "./stream_list"; | |||||||
| import * as sub_store from "./sub_store"; | import * as sub_store from "./sub_store"; | ||||||
| import * as unread_ui from "./unread_ui"; | import * as unread_ui from "./unread_ui"; | ||||||
| import * as user_topics from "./user_topics"; | import * as user_topics from "./user_topics"; | ||||||
|  | import type {ServerUserTopic} from "./user_topics"; | ||||||
| 
 | 
 | ||||||
| export function handle_topic_updates(user_topic_event) { | export function handle_topic_updates(user_topic_event: ServerUserTopic): void { | ||||||
|     // Update the UI after changes in topic visibility policies.
 |     // Update the UI after changes in topic visibility policies.
 | ||||||
|     user_topics.set_user_topic(user_topic_event); |     user_topics.set_user_topic(user_topic_event); | ||||||
|     popover_menus.get_topic_menu_popover()?.hide(); |     popover_menus.get_topic_menu_popover()?.hide(); | ||||||
| @@ -56,7 +58,11 @@ export function handle_topic_updates(user_topic_event) { | |||||||
|     }, 0); |     }, 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function toggle_topic_visibility_policy(message) { | export function toggle_topic_visibility_policy(message: Message): void { | ||||||
|  |     if (message.type !== "stream") { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     const stream_id = message.stream_id; |     const stream_id = message.stream_id; | ||||||
|     const topic = message.topic; |     const topic = message.topic; | ||||||
| 
 | 
 | ||||||
| @@ -69,8 +75,8 @@ export function toggle_topic_visibility_policy(message) { | |||||||
|             topic, |             topic, | ||||||
|             user_topics.all_visibility_policies.INHERIT, |             user_topics.all_visibility_policies.INHERIT, | ||||||
|         ); |         ); | ||||||
|     } else if (message.type === "stream") { |     } else { | ||||||
|         if (sub_store.get(stream_id).is_muted) { |         if (sub_store.get(stream_id)?.is_muted) { | ||||||
|             user_topics.set_user_topic_visibility_policy( |             user_topics.set_user_topic_visibility_policy( | ||||||
|                 stream_id, |                 stream_id, | ||||||
|                 topic, |                 topic, | ||||||
		Reference in New Issue
	
	Block a user