mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	injected: Condition narrow-by-topic handler on page_params.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		@@ -48,19 +48,18 @@ interface CompatElectronBridge extends ElectronBridge {
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const {page_params} = zulipWindow;
 | 
			
		||||
		const {narrow, page_params} = zulipWindow;
 | 
			
		||||
		if (page_params !== undefined) {
 | 
			
		||||
			electron_bridge.send_event('zulip-loaded');
 | 
			
		||||
		}
 | 
			
		||||
	})();
 | 
			
		||||
 | 
			
		||||
	electron_bridge.on_event('narrow-by-topic', (id: number) => {
 | 
			
		||||
		const {narrow} = zulipWindow;
 | 
			
		||||
			electron_bridge.send_event('zulip-loaded', {
 | 
			
		||||
				narrow_by_topic: (id: number) => {
 | 
			
		||||
					const narrowByTopic = narrow?.by_topic ?? narrow?.by_subject;
 | 
			
		||||
					if (narrowByTopic !== undefined) {
 | 
			
		||||
						narrowByTopic(id, {trigger: 'notification'});
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	})();
 | 
			
		||||
 | 
			
		||||
	function attributeListener<T extends EventTarget>(type: string): PropertyDescriptor {
 | 
			
		||||
		const symbol = Symbol('on' + type);
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ ipcRenderer.on('show-notification-settings', () => {
 | 
			
		||||
	}, 100);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
electron_bridge.once('zulip-loaded', () => {
 | 
			
		||||
electron_bridge.once('zulip-loaded', ({narrow_by_topic}) => {
 | 
			
		||||
	// Redirect users to network troubleshooting page
 | 
			
		||||
	const getRestartButton = document.querySelector('.restart_get_events_button');
 | 
			
		||||
	if (getRestartButton) {
 | 
			
		||||
@@ -59,6 +59,8 @@ electron_bridge.once('zulip-loaded', () => {
 | 
			
		||||
			ipcRenderer.send('forward-message', 'reload-viewer');
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	electron_bridge.on('narrow-by-topic', narrow_by_topic);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
window.addEventListener('load', (event: any): void => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user