mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-10-31 03:53:34 +00:00 
			
		
		
		
	Fix linting errors.
This commit is contained in:
		| @@ -1,10 +1,11 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| const {ipcRenderer} = require('electron'); | ||||
|  | ||||
| const BaseComponent = require(__dirname + '/../../components/base.js'); | ||||
| const ConfigUtil = require(__dirname + '/../../utils/config-util.js'); | ||||
|  | ||||
| class GeneralSection extends BaseComponent{ | ||||
| class GeneralSection extends BaseComponent { | ||||
| 	constructor(props) { | ||||
| 		super(); | ||||
| 		this.props = props; | ||||
| @@ -53,15 +54,15 @@ class GeneralSection extends BaseComponent{ | ||||
| 		const $trayOption = this.generateNodeFromTemplate(this.trayOptionTemplate(trayOption)); | ||||
| 		this.$trayOptionSettings.appendChild($trayOption); | ||||
|  | ||||
| 		$trayOption.addEventListener('click', event=> { | ||||
| 		$trayOption.addEventListener('click', () => { | ||||
| 			const newValue = !ConfigUtil.getConfigItem('trayIcon'); | ||||
| 			ConfigUtil.setConfigItem('trayIcon', newValue); | ||||
| 			ipcRenderer.send('forward', 'toggletray'); | ||||
| 			this.initTrayOption(); | ||||
| 		}) | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	handleServerInfoChange(index) { | ||||
| 	handleServerInfoChange() { | ||||
| 		ipcRenderer.send('reload-main'); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -15,7 +15,7 @@ class PreferenceNav extends BaseComponent { | ||||
|  | ||||
| 	template() { | ||||
| 		let navItemsTemplate = ''; | ||||
| 		for (let navItem of this.navItems) { | ||||
| 		for (const navItem of this.navItems) { | ||||
| 			navItemsTemplate += `<div class="nav" id="nav-${navItem}">${navItem}</div>`; | ||||
| 		} | ||||
|  | ||||
| @@ -35,16 +35,16 @@ class PreferenceNav extends BaseComponent { | ||||
| 	} | ||||
|  | ||||
| 	registerListeners() { | ||||
| 		for (let navItem of this.navItems) { | ||||
| 		for (const navItem of this.navItems) { | ||||
| 			const $item = document.getElementById(`nav-${navItem}`); | ||||
| 			$item.addEventListener('click', event => { | ||||
| 			$item.addEventListener('click', () => { | ||||
| 				this.props.onItemSelected(navItem); | ||||
| 			}); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	select(navItemToSelect) { | ||||
| 		for (let navItem of this.navItems) { | ||||
| 		for (const navItem of this.navItems) { | ||||
| 			if (navItem === navItemToSelect) { | ||||
| 				this.activate(navItem); | ||||
| 			} else { | ||||
|   | ||||
| @@ -1,12 +1,9 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| const {ipcRenderer} = require('electron'); | ||||
| const BaseComponent = require(__dirname + '/../../components/base.js'); | ||||
|  | ||||
| const DomainUtil = require(__dirname + '/../../utils/domain-util.js'); | ||||
| const Nav = require(__dirname + '/nav.js'); | ||||
|  | ||||
| class NewServerForm extends BaseComponent{ | ||||
| class NewServerForm extends BaseComponent { | ||||
| 	constructor(props) { | ||||
| 		super(); | ||||
| 		this.props = props; | ||||
|   | ||||
| @@ -1,15 +1,15 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| const {ipcRenderer} = require('electron'); | ||||
| const BaseComponent = require(__dirname + '/js/components/base.js'); | ||||
|  | ||||
|  | ||||
| const Nav = require(__dirname + '/js/pages/preference/nav.js'); | ||||
| const ServersSection = require(__dirname + '/js/pages/preference/servers-section.js'); | ||||
| const GeneralSection = require(__dirname + '/js/pages/preference/general-section.js'); | ||||
|  | ||||
| class PreferenceView { | ||||
| class PreferenceView extends BaseComponent { | ||||
| 	constructor() { | ||||
| 		super(); | ||||
|  | ||||
| 		this.$sidebarContainer = document.getElementById('sidebar'); | ||||
| 		this.$settingsContainer = document.getElementById('settings-container'); | ||||
| 	} | ||||
| @@ -37,6 +37,7 @@ class PreferenceView { | ||||
| 				}); | ||||
| 				break; | ||||
| 			} | ||||
| 			default: break; | ||||
| 		} | ||||
| 		this.section.init(); | ||||
| 	} | ||||
|   | ||||
| @@ -1,12 +1,9 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| const {ipcRenderer} = require('electron'); | ||||
| const BaseComponent = require(__dirname + '/../../components/base.js'); | ||||
|  | ||||
| const DomainUtil = require(__dirname + '/../../utils/domain-util.js'); | ||||
| const Nav = require(__dirname + '/nav.js'); | ||||
|  | ||||
| class ServerInfoForm extends BaseComponent{ | ||||
| class ServerInfoForm extends BaseComponent { | ||||
| 	constructor(props) { | ||||
| 		super(); | ||||
| 		this.props = props; | ||||
|   | ||||
| @@ -1,15 +1,15 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| const {ipcRenderer} = require('electron'); | ||||
| const BaseComponent = require(__dirname + '/../../components/base.js'); | ||||
|  | ||||
| const BaseComponent = require(__dirname + '/../../components/base.js'); | ||||
| const DomainUtil = require(__dirname + '/../../utils/domain-util.js'); | ||||
| const Nav = require(__dirname + '/nav.js'); | ||||
| const ServerInfoForm = require(__dirname + '/server-info-form.js'); | ||||
| const NewServerForm = require(__dirname + '/new-server-form.js'); | ||||
|  | ||||
| class ServersSection { | ||||
| class ServersSection extends BaseComponent { | ||||
| 	constructor(props) { | ||||
| 		super(); | ||||
| 		this.props = props; | ||||
| 	} | ||||
|  | ||||
| @@ -73,7 +73,7 @@ class ServersSection { | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	handleServerInfoChange(index) { | ||||
| 	handleServerInfoChange() { | ||||
| 		ipcRenderer.send('reload-main'); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -47,7 +47,8 @@ const config = { | ||||
|  | ||||
| const renderCanvas = function (arg) { | ||||
| 	config.unreadCount = arg; | ||||
| 	return new Promise((resolve, reject) => { | ||||
|  | ||||
| 	return new Promise(resolve => { | ||||
| 		const SIZE = config.size * config.pixelRatio; | ||||
| 		const PADDING = SIZE * 0.05; | ||||
| 		const CENTER = SIZE / 2; | ||||
| @@ -161,7 +162,9 @@ const createTray = function () { | ||||
| }; | ||||
|  | ||||
| ipcRenderer.on('destroytray', event => { | ||||
| 	if (!window.tray) return; | ||||
| 	if (!window.tray) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	window.tray.destroy(); | ||||
| 	if (window.tray.isDestroyed()) { | ||||
| @@ -174,7 +177,9 @@ ipcRenderer.on('destroytray', event => { | ||||
| }); | ||||
|  | ||||
| ipcRenderer.on('tray', (event, arg) => { | ||||
| 	if (!window.tray) return; | ||||
| 	if (!window.tray) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if (arg === 0) { | ||||
| 		unread = arg; | ||||
| @@ -191,7 +196,6 @@ ipcRenderer.on('tray', (event, arg) => { | ||||
| }); | ||||
|  | ||||
| function toggleTray() { | ||||
| 	console.log(window.tray); | ||||
| 	if (window.tray) { | ||||
| 		window.tray.destroy(); | ||||
| 		if (window.tray.isDestroyed()) { | ||||
| @@ -202,7 +206,7 @@ function toggleTray() { | ||||
| 		createTray(); | ||||
| 		renderNativeImage(unread).then(image => { | ||||
| 			window.tray.setImage(image); | ||||
| 			window.tray.setToolTip(arg + ' unread messages'); | ||||
| 			window.tray.setToolTip(unread + ' unread messages'); | ||||
| 		}); | ||||
| 		ConfigUtil.setConfigItem('trayIcon', true); | ||||
| 	} | ||||
|   | ||||
| @@ -17,8 +17,8 @@ class ConfigUtil { | ||||
| 		return instance; | ||||
| 	} | ||||
|  | ||||
| 	getConfigItem(key, defaultValue=null) { | ||||
| 		let value = this.db.getData('/')[key]; | ||||
| 	getConfigItem(key, defaultValue = null) { | ||||
| 		const value = this.db.getData('/')[key]; | ||||
| 		if (value === undefined) { | ||||
| 			this.setConfigItem(key, value); | ||||
| 			return defaultValue; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user