Fix eslint errors
This commit is contained in:
@@ -6,12 +6,12 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"indent": [2, 2, {"SwitchCase": 0}],
|
"indent": [2, 2, {"SwitchCase": 0}],
|
||||||
"no-console": 0,
|
"no-console": 0,
|
||||||
"no-eval": 1,
|
|
||||||
"no-process-env": 0,
|
"no-process-env": 0,
|
||||||
"no-underscore-dangle": 1,
|
"no-underscore-dangle": 1,
|
||||||
"react/jsx-indent": [2, 2],
|
"react/jsx-indent": [2, 2],
|
||||||
"react/jsx-indent-props": [2, 2],
|
"react/jsx-indent-props": [2, 2],
|
||||||
|
"react/no-set-state": 1,
|
||||||
"react/prefer-es6-class": 1,
|
"react/prefer-es6-class": 1,
|
||||||
"react/no-set-state": 1
|
"react/require-optimization": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable no-process-exit */
|
/* eslint-disable no-process-exit */
|
||||||
|
|
||||||
const {spawn} = require('child_process');
|
const {spawn} = require('child_process');
|
||||||
|
|
||||||
const {path7za} = require('7zip-bin');
|
const {path7za} = require('7zip-bin');
|
||||||
|
|
||||||
const cwd = process.argv[2];
|
const cwd = process.argv[2];
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const spawnSync = require('child_process').spawnSync;
|
const spawnSync = require('child_process').spawnSync;
|
||||||
|
|
||||||
const path7za = require('7zip-bin').path7za;
|
const path7za = require('7zip-bin').path7za;
|
||||||
|
|
||||||
const pkg = require('../src/package.json');
|
const pkg = require('../src/package.json');
|
||||||
const appVersion = pkg.version;
|
const appVersion = pkg.version;
|
||||||
const productName = pkg.productName;
|
const productName = pkg.productName;
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
const electron = require('electron-connect').server.create({path: 'src'});
|
||||||
|
|
||||||
const mainConfig = require('../webpack.config.main.js');
|
const mainConfig = require('../webpack.config.main.js');
|
||||||
const rendererConfig = require('../webpack.config.renderer.js');
|
const rendererConfig = require('../webpack.config.renderer.js');
|
||||||
const electron = require('electron-connect').server.create({path: 'src'});
|
|
||||||
|
|
||||||
let started = false;
|
let started = false;
|
||||||
|
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
const url = require('url');
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const createReactClass = require('create-react-class');
|
const createReactClass = require('create-react-class');
|
||||||
@@ -5,7 +7,8 @@ const ReactCSSTransitionGroup = require('react-transition-group/CSSTransitionGro
|
|||||||
const {Grid, Row} = require('react-bootstrap');
|
const {Grid, Row} = require('react-bootstrap');
|
||||||
|
|
||||||
const {ipcRenderer, remote} = require('electron');
|
const {ipcRenderer, remote} = require('electron');
|
||||||
const url = require('url');
|
|
||||||
|
const Utils = require('../../utils/util.js');
|
||||||
|
|
||||||
const LoginModal = require('./LoginModal.jsx');
|
const LoginModal = require('./LoginModal.jsx');
|
||||||
const MattermostView = require('./MattermostView.jsx');
|
const MattermostView = require('./MattermostView.jsx');
|
||||||
@@ -15,8 +18,6 @@ const PermissionRequestDialog = require('./PermissionRequestDialog.jsx');
|
|||||||
|
|
||||||
const NewTeamModal = require('./NewTeamModal.jsx');
|
const NewTeamModal = require('./NewTeamModal.jsx');
|
||||||
|
|
||||||
const Utils = require('../../utils/util.js');
|
|
||||||
|
|
||||||
const MainPage = createReactClass({
|
const MainPage = createReactClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
onUnreadCountChange: PropTypes.func.isRequired,
|
onUnreadCountChange: PropTypes.func.isRequired,
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
// eslint-disable react/no-set-state
|
/* eslint-disable react/no-set-state */
|
||||||
// setState() is necessary for this component
|
// setState() is necessary for this component
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const createReactClass = require('create-react-class');
|
const createReactClass = require('create-react-class');
|
||||||
const {findDOMNode} = require('react-dom');
|
const {findDOMNode} = require('react-dom');
|
||||||
const {ipcRenderer, remote, shell} = require('electron');
|
const {ipcRenderer, remote, shell} = require('electron');
|
||||||
const url = require('url');
|
|
||||||
const contextMenu = require('../js/contextMenu');
|
const contextMenu = require('../js/contextMenu');
|
||||||
const {protocols} = require('../../../electron-builder.json');
|
const {protocols} = require('../../../electron-builder.json');
|
||||||
const scheme = protocols[0].schemes[0];
|
const scheme = protocols[0].schemes[0];
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const {Modal} = require('react-bootstrap');
|
const {Modal} = require('react-bootstrap');
|
||||||
|
|
||||||
const DestructiveConfirmationModal = require('./DestructiveConfirmModal.jsx');
|
const DestructiveConfirmationModal = require('./DestructiveConfirmModal.jsx');
|
||||||
|
|
||||||
function RemoveServerModal(props) {
|
function RemoveServerModal(props) {
|
||||||
|
@@ -492,8 +492,8 @@ const SettingsPage = createReactClass({
|
|||||||
checked={this.state.showTrayIcon}
|
checked={this.state.showTrayIcon}
|
||||||
onChange={this.handleChangeShowTrayIcon}
|
onChange={this.handleChangeShowTrayIcon}
|
||||||
>{process.platform === 'darwin' ?
|
>{process.platform === 'darwin' ?
|
||||||
`Show ${remote.app.getName()} icon in the menu bar` :
|
`Show ${remote.app.getName()} icon in the menu bar` :
|
||||||
'Show icon in the notification area'}
|
'Show icon in the notification area'}
|
||||||
<HelpBlock>
|
<HelpBlock>
|
||||||
{'Setting takes effect after restarting the app.'}
|
{'Setting takes effect after restarting the app.'}
|
||||||
</HelpBlock>
|
</HelpBlock>
|
||||||
@@ -567,7 +567,7 @@ const SettingsPage = createReactClass({
|
|||||||
)) }
|
)) }
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const {findDOMNode} = require('react-dom');
|
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const {Glyphicon, Nav, NavItem, Overlay} = require('react-bootstrap');
|
const {Glyphicon, Nav, NavItem, Overlay} = require('react-bootstrap');
|
||||||
|
|
||||||
const PermissionRequestDialog = require('./PermissionRequestDialog.jsx');
|
const PermissionRequestDialog = require('./PermissionRequestDialog.jsx');
|
||||||
|
|
||||||
class TabBar extends React.Component { // need "this"
|
class TabBar extends React.Component { // need "this"
|
||||||
@@ -74,7 +74,7 @@ class TabBar extends React.Component { // need "this"
|
|||||||
>
|
>
|
||||||
<Glyphicon glyph='plus'/>
|
<Glyphicon glyph='plus'/>
|
||||||
</NavItem>
|
</NavItem>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Nav
|
<Nav
|
||||||
|
@@ -2,6 +2,7 @@ const React = require('react');
|
|||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const createReactClass = require('create-react-class');
|
const createReactClass = require('create-react-class');
|
||||||
const {ListGroup} = require('react-bootstrap');
|
const {ListGroup} = require('react-bootstrap');
|
||||||
|
|
||||||
const TeamListItem = require('./TeamListItem.jsx');
|
const TeamListItem = require('./TeamListItem.jsx');
|
||||||
const NewTeamModal = require('./NewTeamModal.jsx');
|
const NewTeamModal = require('./NewTeamModal.jsx');
|
||||||
const RemoveServerModal = require('./RemoveServerModal.jsx');
|
const RemoveServerModal = require('./RemoveServerModal.jsx');
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
const settings = require('../../common/settings');
|
|
||||||
const {remote} = require('electron');
|
const {remote} = require('electron');
|
||||||
|
|
||||||
|
const settings = require('../../common/settings');
|
||||||
|
|
||||||
class AppConfig {
|
class AppConfig {
|
||||||
constructor(file) {
|
constructor(file) {
|
||||||
this.fileName = file;
|
this.fileName = file;
|
||||||
|
@@ -2,23 +2,24 @@
|
|||||||
|
|
||||||
require('./css/index.css');
|
require('./css/index.css');
|
||||||
|
|
||||||
window.eval = global.eval = () => {
|
window.eval = global.eval = () => { // eslint-disable-line no-multi-assign, no-eval
|
||||||
throw new Error('Sorry, Mattermost does not support window.eval() for security reasons.');
|
throw new Error('Sorry, Mattermost does not support window.eval() for security reasons.');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const ReactDOM = require('react-dom');
|
const ReactDOM = require('react-dom');
|
||||||
const {remote, ipcRenderer} = require('electron');
|
const {remote, ipcRenderer} = require('electron');
|
||||||
const MainPage = require('./components/MainPage.jsx');
|
|
||||||
|
|
||||||
const AppConfig = require('./config/AppConfig.js');
|
|
||||||
const buildConfig = require('../common/config/buildConfig');
|
const buildConfig = require('../common/config/buildConfig');
|
||||||
const settings = require('../common/settings');
|
const settings = require('../common/settings');
|
||||||
const url = require('url');
|
|
||||||
|
|
||||||
const badge = require('./js/badge');
|
|
||||||
const utils = require('../utils/util');
|
const utils = require('../utils/util');
|
||||||
|
|
||||||
|
const MainPage = require('./components/MainPage.jsx');
|
||||||
|
const AppConfig = require('./config/AppConfig.js');
|
||||||
|
const badge = require('./js/badge');
|
||||||
|
|
||||||
const teams = settings.mergeDefaultTeams(AppConfig.data.teams);
|
const teams = settings.mergeDefaultTeams(AppConfig.data.teams);
|
||||||
|
|
||||||
remote.getCurrentWindow().removeAllListeners('focus');
|
remote.getCurrentWindow().removeAllListeners('focus');
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
const OriginalNotification = Notification;
|
const OriginalNotification = Notification;
|
||||||
const {ipcRenderer, remote} = require('electron');
|
const {ipcRenderer, remote} = require('electron');
|
||||||
const {throttle} = require('underscore');
|
const {throttle} = require('underscore');
|
||||||
|
|
||||||
const osVersion = require('../../common/osVersion');
|
const osVersion = require('../../common/osVersion');
|
||||||
const dingDataURL = require('../../assets/ding.mp3'); // https://github.com/mattermost/platform/blob/v3.7.3/webapp/images/ding.mp3
|
const dingDataURL = require('../../assets/ding.mp3'); // https://github.com/mattermost/platform/blob/v3.7.3/webapp/images/ding.mp3
|
||||||
|
|
||||||
|
@@ -1,15 +1,17 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const {remote} = require('electron');
|
const {remote} = require('electron');
|
||||||
|
|
||||||
window.eval = global.eval = () => {
|
window.eval = global.eval = () => { // eslint-disable-line no-multi-assign, no-eval
|
||||||
throw new Error(`Sorry, ${remote.app.getName()} does not support window.eval() for security reasons.`);
|
throw new Error(`Sorry, ${remote.app.getName()} does not support window.eval() for security reasons.`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const ReactDOM = require('react-dom');
|
const ReactDOM = require('react-dom');
|
||||||
|
|
||||||
|
const buildConfig = require('../common/config/buildConfig');
|
||||||
|
|
||||||
const SettingsPage = require('./components/SettingsPage.jsx');
|
const SettingsPage = require('./components/SettingsPage.jsx');
|
||||||
const contextMenu = require('./js/contextMenu');
|
const contextMenu = require('./js/contextMenu');
|
||||||
const buildConfig = require('../common/config/buildConfig');
|
|
||||||
|
|
||||||
const configFile = remote.app.getPath('userData') + '/config.json';
|
const configFile = remote.app.getPath('userData') + '/config.json';
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const ipc = electron.ipcRenderer;
|
const ipc = electron.ipcRenderer;
|
||||||
const webFrame = electron.webFrame;
|
const webFrame = electron.webFrame;
|
||||||
|
|
||||||
const EnhancedNotification = require('../js/notification');
|
const EnhancedNotification = require('../js/notification');
|
||||||
|
|
||||||
const UNREAD_COUNT_INTERVAL = 1000;
|
const UNREAD_COUNT_INTERVAL = 1000;
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const buildConfig = require('./config/buildConfig');
|
const buildConfig = require('./config/buildConfig');
|
||||||
|
|
||||||
function merge(base, target) {
|
function merge(base, target) {
|
||||||
|
91
src/main.js
91
src/main.js
@@ -1,5 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const os = require('os');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
app,
|
app,
|
||||||
Menu,
|
Menu,
|
||||||
@@ -10,15 +13,15 @@ const {
|
|||||||
systemPreferences,
|
systemPreferences,
|
||||||
session,
|
session,
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
const os = require('os');
|
|
||||||
const path = require('path');
|
|
||||||
const isDev = require('electron-is-dev');
|
const isDev = require('electron-is-dev');
|
||||||
const installExtension = require('electron-devtools-installer');
|
const installExtension = require('electron-devtools-installer');
|
||||||
const squirrelStartup = require('./main/squirrelStartup');
|
const parseArgv = require('yargs').parse;
|
||||||
const CriticalErrorHandler = require('./main/CriticalErrorHandler');
|
|
||||||
|
|
||||||
const protocols = require('../electron-builder.json').protocols;
|
const protocols = require('../electron-builder.json').protocols;
|
||||||
|
|
||||||
|
const squirrelStartup = require('./main/squirrelStartup');
|
||||||
|
const CriticalErrorHandler = require('./main/CriticalErrorHandler');
|
||||||
|
|
||||||
const criticalErrorHandler = new CriticalErrorHandler();
|
const criticalErrorHandler = new CriticalErrorHandler();
|
||||||
|
|
||||||
process.on('uncaughtException', criticalErrorHandler.processUncaughtExceptionHandler.bind(criticalErrorHandler));
|
process.on('uncaughtException', criticalErrorHandler.processUncaughtExceptionHandler.bind(criticalErrorHandler));
|
||||||
@@ -54,7 +57,7 @@ let scheme = null;
|
|||||||
let appState = null;
|
let appState = null;
|
||||||
let permissionManager = null;
|
let permissionManager = null;
|
||||||
|
|
||||||
var argv = require('yargs').parse(process.argv.slice(1));
|
const argv = parseArgv(process.argv.slice(1));
|
||||||
|
|
||||||
var hideOnStartup;
|
var hideOnStartup;
|
||||||
if (argv.hidden) {
|
if (argv.hidden) {
|
||||||
@@ -117,40 +120,40 @@ const trayImages = (() => {
|
|||||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico')),
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico')),
|
||||||
};
|
};
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
{
|
{
|
||||||
const icons = {
|
const icons = {
|
||||||
light: {
|
light: {
|
||||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIcon.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIcon.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconUnread.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconUnread.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconMention.png')),
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconMention.png')),
|
||||||
},
|
},
|
||||||
clicked: {
|
clicked: {
|
||||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIcon.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIcon.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconUnread.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconUnread.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconMention.png')),
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconMention.png')),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
switchMenuIconImages(icons, systemPreferences.isDarkMode());
|
switchMenuIconImages(icons, systemPreferences.isDarkMode());
|
||||||
return icons;
|
return icons;
|
||||||
}
|
}
|
||||||
case 'linux':
|
case 'linux':
|
||||||
{
|
{
|
||||||
const theme = config.trayIconTheme;
|
const theme = config.trayIconTheme;
|
||||||
try {
|
try {
|
||||||
return {
|
return {
|
||||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png')),
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png')),
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//Fallback for invalid theme setting
|
//Fallback for invalid theme setting
|
||||||
return {
|
return {
|
||||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconTemplate.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconTemplate.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconUnreadTemplate.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconUnreadTemplate.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconMentionTemplate.png')),
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconMentionTemplate.png')),
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -564,13 +567,13 @@ app.on('ready', () => {
|
|||||||
ipcMain.on('update-dict', () => {
|
ipcMain.on('update-dict', () => {
|
||||||
if (config.useSpellChecker) {
|
if (config.useSpellChecker) {
|
||||||
spellChecker = new SpellChecker(
|
spellChecker = new SpellChecker(
|
||||||
config.spellCheckerLocale,
|
config.spellCheckerLocale,
|
||||||
path.resolve(app.getAppPath(), 'node_modules/simple-spellchecker/dict'),
|
path.resolve(app.getAppPath(), 'node_modules/simple-spellchecker/dict'),
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ipcMain.on('checkspell', (event, word) => {
|
ipcMain.on('checkspell', (event, word) => {
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
const {app, dialog} = require('electron');
|
|
||||||
const {spawn} = require('child_process');
|
const {spawn} = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const {app, dialog} = require('electron');
|
||||||
|
|
||||||
const BUTTON_OK = 'OK';
|
const BUTTON_OK = 'OK';
|
||||||
const BUTTON_SHOW_DETAILS = 'Show Details';
|
const BUTTON_SHOW_DETAILS = 'Show Details';
|
||||||
const BUTTON_REOPEN = 'Reopen';
|
const BUTTON_REOPEN = 'Reopen';
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const utils = require('../utils/util');
|
const utils = require('../utils/util');
|
||||||
|
|
||||||
const PERMISSION_GRANTED = 'granted';
|
const PERMISSION_GRANTED = 'granted';
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
|
|
||||||
const simpleSpellChecker = require('simple-spellchecker');
|
const simpleSpellChecker = require('simple-spellchecker');
|
||||||
|
|
||||||
/// Following approach for contractions is derived from electron-spellchecker.
|
/// Following approach for contractions is derived from electron-spellchecker.
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
app,
|
app,
|
||||||
dialog,
|
dialog,
|
||||||
ipcMain,
|
ipcMain,
|
||||||
shell,
|
shell,
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const allowedProtocolFile = path.resolve(app.getPath('userData'), 'allowedProtocols.json');
|
const allowedProtocolFile = path.resolve(app.getPath('userData'), 'allowedProtocols.json');
|
||||||
var allowedProtocols = [];
|
var allowedProtocols = [];
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const {app, dialog} = electron;
|
const {app, dialog} = electron;
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
const {app, BrowserWindow} = require('electron');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const {app, BrowserWindow} = require('electron');
|
||||||
|
|
||||||
function saveWindowState(file, window) {
|
function saveWindowState(file, window) {
|
||||||
var windowState = window.getBounds();
|
var windowState = window.getBounds();
|
||||||
windowState.maximized = window.isMaximized();
|
windowState.maximized = window.isMaximized();
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
|
|
||||||
const settings = require('../../common/settings');
|
const settings = require('../../common/settings');
|
||||||
const buildConfig = require('../../common/config/buildConfig');
|
const buildConfig = require('../../common/config/buildConfig');
|
||||||
|
|
||||||
@@ -58,7 +59,8 @@ function createTemplate(mainWindow, config, isDev) {
|
|||||||
role: 'unhide',
|
role: 'unhide',
|
||||||
}, separatorItem, {
|
}, separatorItem, {
|
||||||
role: 'quit',
|
role: 'quit',
|
||||||
}] : [separatorItem, {
|
}] : [
|
||||||
|
separatorItem, {
|
||||||
role: 'quit',
|
role: 'quit',
|
||||||
accelerator: 'CmdOrCtrl+Q',
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
click() {
|
click() {
|
||||||
|
@@ -4,6 +4,7 @@ const {
|
|||||||
app,
|
app,
|
||||||
Menu,
|
Menu,
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
|
|
||||||
const settings = require('../../common/settings');
|
const settings = require('../../common/settings');
|
||||||
|
|
||||||
function createTemplate(mainWindow, config, isDev) {
|
function createTemplate(mainWindow, config, isDev) {
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
const {ipcMain} = require('electron');
|
|
||||||
const {URL} = require('url');
|
const {URL} = require('url');
|
||||||
|
|
||||||
|
const {ipcMain} = require('electron');
|
||||||
|
|
||||||
function dequeueRequests(requestQueue, permissionManager, origin, permission, status) {
|
function dequeueRequests(requestQueue, permissionManager, origin, permission, status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'allow':
|
case 'allow':
|
||||||
|
@@ -14,10 +14,10 @@ async function setupAutoLaunch(cmd) {
|
|||||||
isHidden: true,
|
isHidden: true,
|
||||||
});
|
});
|
||||||
if (cmd === '--squirrel-uninstall') {
|
if (cmd === '--squirrel-uninstall') {
|
||||||
// If we're uninstalling, make sure we also delete our auto launch registry key
|
// If we're uninstalling, make sure we also delete our auto launch registry key
|
||||||
return appLauncher.disable();
|
return appLauncher.disable();
|
||||||
} else if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
} else if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
||||||
// If we're updating and already have an registry entry for auto launch, make sure to update the path
|
// If we're updating and already have an registry entry for auto launch, make sure to update the path
|
||||||
const enabled = await appLauncher.isEnabled();
|
const enabled = await appLauncher.isEnabled();
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
return appLauncher.enable();
|
return appLauncher.enable();
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const chai = require('chai');
|
|
||||||
chai.should();
|
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const Application = require('spectron').Application;
|
const Application = require('spectron').Application;
|
||||||
|
const chai = require('chai');
|
||||||
|
chai.should();
|
||||||
|
|
||||||
const sourceRootDir = path.join(__dirname, '../..');
|
const sourceRootDir = path.join(__dirname, '../..');
|
||||||
const electronBinaryPath = (() => {
|
const electronBinaryPath = (() => {
|
||||||
|
@@ -93,33 +93,33 @@ describe('browser/settings.html', function desc() {
|
|||||||
it('should open the corresponding tab when a server list item is clicked', () => {
|
it('should open the corresponding tab when a server list item is clicked', () => {
|
||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
click('h4=example').
|
click('h4=example').
|
||||||
pause(1000).
|
pause(100).
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().then((url) => {
|
getUrl().then((url) => {
|
||||||
url.should.match(/\/index.html(\?.+)?$/);
|
url.should.match(/\/index.html(\?.+)?$/);
|
||||||
}).
|
}).
|
||||||
isVisible('#mattermostView0').then((visible) => {
|
isVisible('#mattermostView0').then((visible) => {
|
||||||
visible.should.be.true;
|
visible.should.be.true;
|
||||||
}).
|
}).
|
||||||
isVisible('#mattermostView1').then((visible) => {
|
isVisible('#mattermostView1').then((visible) => {
|
||||||
visible.should.be.false;
|
visible.should.be.false;
|
||||||
}).
|
}).
|
||||||
|
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
click('h4=github').
|
click('h4=github').
|
||||||
pause(1000).
|
pause(100).
|
||||||
waitUntilWindowLoaded().
|
waitUntilWindowLoaded().
|
||||||
getUrl().then((url) => {
|
getUrl().then((url) => {
|
||||||
url.should.match(/\/index.html(\?.+)?$/);
|
url.should.match(/\/index.html(\?.+)?$/);
|
||||||
}).
|
}).
|
||||||
isVisible('#mattermostView0').then((visible) => {
|
isVisible('#mattermostView0').then((visible) => {
|
||||||
visible.should.be.false;
|
visible.should.be.false;
|
||||||
}).
|
}).
|
||||||
isVisible('#mattermostView1').then((visible) => {
|
isVisible('#mattermostView1').then((visible) => {
|
||||||
visible.should.be.true;
|
visible.should.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -129,10 +129,10 @@ describe('browser/settings.html', function desc() {
|
|||||||
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
isExisting('#inputHideMenuBar').then((existing) => {
|
isExisting('#inputHideMenuBar').then((existing) => {
|
||||||
existing.should.equal(expected);
|
existing.should.equal(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
[true, false].forEach((v) => {
|
[true, false].forEach((v) => {
|
||||||
@@ -398,15 +398,15 @@ describe('browser/settings.html', function desc() {
|
|||||||
describe('Valid server name', () => {
|
describe('Valid server name', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
setValue('#teamNameInput', 'TestTeam').
|
setValue('#teamNameInput', 'TestTeam').
|
||||||
click('#saveNewServerModal');
|
click('#saveNewServerModal');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be marked invalid', () => {
|
it('should not be marked invalid', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
isExisting('.has-error #teamNameInput').then((existing) => {
|
isExisting('.has-error #teamNameInput').then((existing) => {
|
||||||
existing.should.be.false;
|
existing.should.be.false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be possible to click save', () => {
|
it('should not be possible to click save', () => {
|
||||||
@@ -420,8 +420,8 @@ describe('browser/settings.html', function desc() {
|
|||||||
describe('Valid server url', () => {
|
describe('Valid server url', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
setValue('#teamUrlInput', 'http://example.org').
|
setValue('#teamUrlInput', 'http://example.org').
|
||||||
click('#saveNewServerModal');
|
click('#saveNewServerModal');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be valid', () => {
|
it('should be valid', () => {
|
||||||
@@ -452,8 +452,8 @@ describe('browser/settings.html', function desc() {
|
|||||||
describe('Valid Team Settings', () => {
|
describe('Valid Team Settings', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
setValue('#teamUrlInput', 'http://example.org').
|
setValue('#teamUrlInput', 'http://example.org').
|
||||||
setValue('#teamNameInput', 'TestTeam');
|
setValue('#teamNameInput', 'TestTeam');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be possible to click add', () => {
|
it('should be possible to click add', () => {
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const env = require('../modules/environment');
|
const env = require('../modules/environment');
|
||||||
const PermissionManager = require('../../src/main/PermissionManager');
|
const PermissionManager = require('../../src/main/PermissionManager');
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
const SpellChecker = require('../../src/main/SpellChecker');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const SpellChecker = require('../../src/main/SpellChecker');
|
||||||
|
|
||||||
describe('main/Spellchecker.js', function() {
|
describe('main/Spellchecker.js', function() {
|
||||||
describe('en-US', function() {
|
describe('en-US', function() {
|
||||||
let spellchecker = null;
|
let spellchecker = null;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
|
|
||||||
const base = require('./webpack.config.base');
|
const base = require('./webpack.config.base');
|
||||||
|
|
||||||
module.exports = merge(base, {
|
module.exports = merge(base, {
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
|
|
||||||
const base = require('./webpack.config.base');
|
const base = require('./webpack.config.base');
|
||||||
|
|
||||||
module.exports = merge(base, {
|
module.exports = merge(base, {
|
||||||
|
Reference in New Issue
Block a user