mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-10-31 12:03:39 +00:00 
			
		
		
		
	Fix linting errors.
This commit is contained in:
		| @@ -1,55 +0,0 @@ | ||||
| 'use strict'; | ||||
| const path = require('path'); | ||||
| const {BrowserWindow, ipcMain} = require('electron'); | ||||
|  | ||||
| let aboutWindow; | ||||
|  | ||||
| function onClosed() { | ||||
| 	// Dereference the window | ||||
| 	domainWindow = null; | ||||
| 	aboutWindow = null; | ||||
| } | ||||
| // About window | ||||
| function createAboutWindow() { | ||||
| 	const aboutwin = new electron.BrowserWindow({ | ||||
| 		width: 500, | ||||
| 		height: 500, | ||||
| 		title: 'About Zulip Desktop', | ||||
| 		show: false, | ||||
| 		center: true, | ||||
| 		fullscreen: false, | ||||
| 		fullscreenable: false, | ||||
| 		resizable: false | ||||
| 	}); | ||||
| 	const aboutURL = 'file://' + path.join(__dirname, '../renderer', 'about.html'); | ||||
| 	aboutwin.loadURL(aboutURL); | ||||
| 	aboutwin.on('closed', onClosed); | ||||
|  | ||||
| 	// Stop page to update it's title | ||||
| 	aboutwin.on('page-title-updated', e => { | ||||
| 		e.preventDefault(); | ||||
| 	}); | ||||
|  | ||||
| 	aboutwin.on('closed', onClosed); | ||||
|  | ||||
| 	return aboutwin; | ||||
| } | ||||
|  | ||||
| // Call this onClick About in tray | ||||
| function about() { | ||||
| 	aboutWindow = createAboutWindow(); | ||||
| 	aboutWindow.once('ready-to-show', () => { | ||||
| 		aboutWindow.show(); | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| ipcMain.on('trayabout', event => { | ||||
| 	if (event) { | ||||
| 		about(); | ||||
| 	} | ||||
| }); | ||||
|  | ||||
| module.exports = { | ||||
| 	addDomain, | ||||
| 	about | ||||
| }; | ||||
| @@ -270,8 +270,10 @@ const otherTpl = [ | ||||
| 		submenu: [ | ||||
| 			{ | ||||
| 				label: 'Zulip desktop', | ||||
| 				click() { | ||||
| 					about(); | ||||
| 				click(item, focusedWindow) { | ||||
| 					if (focusedWindow) { | ||||
| 						sendAction('open-about'); | ||||
| 					} | ||||
| 				} | ||||
| 			}, | ||||
| 			{ | ||||
|   | ||||
| @@ -3,10 +3,6 @@ | ||||
| const Tab = require(__dirname + '/../components/tab.js'); | ||||
|  | ||||
| class FunctionalTab extends Tab { | ||||
| 	constructor(props) { | ||||
| 		super(props); | ||||
| 	} | ||||
|  | ||||
| 	template() { | ||||
| 		return `<div class="tab"> | ||||
| 					<div class="server-tab-badge close-button"> | ||||
| @@ -17,7 +13,7 @@ class FunctionalTab extends Tab { | ||||
| 					</div> | ||||
| 				</div>`; | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	init() { | ||||
| 		this.$el = this.generateNodeFromTemplate(this.template()); | ||||
| 		this.props.$root.appendChild(this.$el); | ||||
| @@ -37,7 +33,7 @@ class FunctionalTab extends Tab { | ||||
| 			this.$closeButton.classList.remove('active'); | ||||
| 		}); | ||||
|  | ||||
| 		this.$closeButton.addEventListener('click', (e) => { | ||||
| 		this.$closeButton.addEventListener('click', e => { | ||||
| 			this.props.onDestroy(); | ||||
| 			e.stopPropagation(); | ||||
| 		}); | ||||
|   | ||||
| @@ -3,10 +3,6 @@ | ||||
| const Tab = require(__dirname + '/../components/tab.js'); | ||||
|  | ||||
| class ServerTab extends Tab { | ||||
| 	constructor(props) { | ||||
| 		super(props); | ||||
| 	} | ||||
|  | ||||
| 	template() { | ||||
| 		return `<div class="tab"> | ||||
| 					<div class="server-tab-badge"></div> | ||||
|   | ||||
| @@ -13,7 +13,7 @@ class WebView extends BaseComponent { | ||||
| 		super(); | ||||
|  | ||||
| 		this.props = props; | ||||
| 		 | ||||
|  | ||||
| 		this.zoomFactor = 1.0; | ||||
| 		this.loading = false; | ||||
| 		this.badgeCount = 0; | ||||
|   | ||||
| @@ -68,10 +68,9 @@ class ServerManagerView { | ||||
| 		this.$addServerButton.addEventListener('click', this.openSettings.bind(this)); | ||||
| 		this.$settingsButton.addEventListener('click', this.openSettings.bind(this)); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	openFunctionalTab(tabProps) { | ||||
| 		const {name, materialIcon, url} = tabProps; | ||||
| 		if (this.functionalTabs.hasOwnProperty(name)) { | ||||
| 		if (this.functionalTabs.name) { | ||||
| 			this.activateTab(this.functionalTabs[name]); | ||||
| 			return; | ||||
| 		} | ||||
| @@ -102,21 +101,21 @@ class ServerManagerView { | ||||
|  | ||||
| 	openSettings() { | ||||
| 		this.openFunctionalTab({ | ||||
| 				name: 'Settings', | ||||
| 				materialIcon: 'settings', | ||||
| 				url: `file://${__dirname}/preference.html` | ||||
| 			name: 'Settings', | ||||
| 			materialIcon: 'settings', | ||||
| 			url: `file://${__dirname}/preference.html` | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	openAbout() { | ||||
| 		this.openFunctionalTab({ | ||||
| 				name: 'About', | ||||
| 				materialIcon: 'sentiment_very_satisfied', | ||||
| 				url: `file://${__dirname}/about.html` | ||||
| 			}); | ||||
| 			name: 'About', | ||||
| 			materialIcon: 'sentiment_very_satisfied', | ||||
| 			url: `file://${__dirname}/about.html` | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	activateTab(index, hideOldTab=true) { | ||||
| 	activateTab(index, hideOldTab = true) { | ||||
| 		if (this.webviews[index].loading) { | ||||
| 			return; | ||||
| 		} | ||||
| @@ -154,10 +153,10 @@ class ServerManagerView { | ||||
| 	updateBadge() { | ||||
| 		let messageCountAll = 0; | ||||
| 		for (let i = 0; i < this.webviews.length; i++) { | ||||
| 			if (this.tabs[i] && this.tabs[i].hasOwnProperty('updateBadge')) { | ||||
| 			if (this.tabs[i] && this.tabs[i].updateBadge) { | ||||
| 				const count = this.webviews[i].badgeCount; | ||||
| 				messageCountAll += count; | ||||
| 				this.tabs[i].updateBadge(count);				 | ||||
| 				this.tabs[i].updateBadge(count); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
|   | ||||
| @@ -25,7 +25,7 @@ class DomainUtil { | ||||
| 			this.db.delete('/domain'); | ||||
| 		} | ||||
|  | ||||
| 		return instance;		 | ||||
| 		return instance; | ||||
| 	} | ||||
|  | ||||
| 	getDomains() { | ||||
|   | ||||
| @@ -15,15 +15,15 @@ class LinkUtil { | ||||
| 		return instance; | ||||
| 	} | ||||
|  | ||||
|     isInternal(currentUrl, newUrl) { | ||||
|         const currentDomain = wurl('hostname', currentUrl); | ||||
|         const newDomain = wurl('hostname', newUrl); | ||||
| 	isInternal(currentUrl, newUrl) { | ||||
| 		const currentDomain = wurl('hostname', currentUrl); | ||||
| 		const newDomain = wurl('hostname', newUrl); | ||||
|  | ||||
|         const skipImages = '.jpg|.gif|.png|.jpeg|.JPG|.PNG'; | ||||
| 		const skipImages = '.jpg|.gif|.png|.jpeg|.JPG|.PNG'; | ||||
|  | ||||
|         // We'll be needing this to open images in default browser | ||||
|         return (currentDomain === newDomain) || newUrl.match(skipImages); | ||||
|     } | ||||
| 		// We'll be needing this to open images in default browser | ||||
| 		return (currentDomain === newDomain) || newUrl.match(skipImages); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| module.exports = new LinkUtil(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user