invoke yarn fix:js to adopt the updated eslint rules. No other changes are included.

This commit is contained in:
Jesse Hallam 2018-02-21 14:20:33 -05:00
parent 38bcaaae5e
commit 620c5484e3
No known key found for this signature in database
GPG key ID: E7959EB6518AF966
49 changed files with 251 additions and 251 deletions

View file

@ -4,7 +4,7 @@ function validateBuildConfig(config) {
if (config.enableServerManagement === false && config.defaultTeams && config.defaultTeams.length === 0) {
return {
result: false,
message: `Specify at least one server for "defaultTeams" in buildConfig.js when "enableServerManagement is set to false.\n${JSON.stringify(config, null, 2)}`
message: `Specify at least one server for "defaultTeams" in buildConfig.js when "enableServerManagement is set to false.\n${JSON.stringify(config, null, 2)}`,
};
}
return {result: true};

View file

@ -7,7 +7,7 @@ const cwd = process.argv[2];
spawn(path7za, ['e', '-y', '*.zip'], {
cwd,
stdio: 'inherit'
stdio: 'inherit',
}).on('error', (err) => {
console.error(err);
process.exit(1);

View file

@ -41,14 +41,14 @@ function AutoSaveIndicator(props) {
AutoSaveIndicator.propTypes = {
savingState: PropTypes.string.isRequired,
errorMessage: PropTypes.string
errorMessage: PropTypes.string,
};
Object.assign(AutoSaveIndicator, {
SAVING_STATE_SAVING,
SAVING_STATE_SAVED,
SAVING_STATE_ERROR,
SAVING_STATE_DONE
SAVING_STATE_DONE,
});
module.exports = AutoSaveIndicator;

View file

@ -37,7 +37,7 @@ DestructiveConfirmationModal.propTypes = {
acceptLabel: PropTypes.string.isRequired,
cancelLabel: PropTypes.string.isRequired,
onAccept: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired
onCancel: PropTypes.func.isRequired,
};
module.exports = DestructiveConfirmationModal;

View file

@ -80,7 +80,7 @@ ErrorView.propTypes = {
errorInfo: PropTypes.object,
id: PropTypes.number,
active: PropTypes.bool,
withTab: PropTypes.bool
withTab: PropTypes.bool,
};
module.exports = ErrorView;

View file

@ -10,7 +10,7 @@ function HoveringURL(props) {
}
HoveringURL.propTypes = {
targetURL: PropTypes.string
targetURL: PropTypes.string,
};
module.exports = HoveringURL;

View file

@ -92,7 +92,7 @@ LoginModal.propTypes = {
onCancel: PropTypes.func,
onLogin: PropTypes.func,
request: PropTypes.object,
show: PropTypes.bool
show: PropTypes.bool,
};
module.exports = LoginModal;

View file

@ -28,7 +28,7 @@ const MainPage = createReactClass({
deeplinkingUrl: PropTypes.string,
showAddServerButton: PropTypes.bool.isRequired,
requestingPermission: TabBar.propTypes.requestingPermission,
onClickPermissionDialog: PropTypes.func
onClickPermissionDialog: PropTypes.func,
},
getInitialState() {
@ -48,22 +48,22 @@ const MainPage = createReactClass({
unreadAtActive: new Array(this.props.teams.length),
mentionAtActiveCounts: new Array(this.props.teams.length),
loginQueue: [],
targetURL: ''
targetURL: '',
};
},
componentDidMount() {
var self = this;
ipcRenderer.on('login-request', (event, request, authInfo) => {
self.setState({
loginRequired: true
loginRequired: true,
});
const loginQueue = self.state.loginQueue;
loginQueue.push({
request,
authInfo
authInfo,
});
self.setState({
loginQueue
loginQueue,
});
});
@ -146,13 +146,13 @@ const MainPage = createReactClass({
handleSelect(key) {
const newKey = (this.props.teams.length + key) % this.props.teams.length;
this.setState({
key: newKey
key: newKey,
});
this.handleOnTeamFocused(newKey);
var webview = document.getElementById('mattermostView' + newKey);
ipcRenderer.send('update-title', {
title: webview.getTitle()
title: webview.getTitle(),
});
},
handleUnreadCountChange(index, unreadCount, mentionCount, isUnread, isMentioned) {
@ -174,7 +174,7 @@ const MainPage = createReactClass({
unreadCounts,
mentionCounts,
unreadAtActive,
mentionAtActiveCounts
mentionAtActiveCounts,
});
this.handleUnreadCountTotalChange();
},
@ -185,7 +185,7 @@ const MainPage = createReactClass({
mentionAtActiveCounts[index] = 0;
this.setState({
unreadAtActive,
mentionAtActiveCounts
mentionAtActiveCounts,
});
this.handleUnreadCountTotalChange();
},
@ -237,7 +237,7 @@ const MainPage = createReactClass({
},
addServer() {
this.setState({
showNewTeamModal: true
showNewTeamModal: true,
});
},
@ -321,14 +321,14 @@ const MainPage = createReactClass({
show={this.state.showNewTeamModal}
onClose={() => {
this.setState({
showNewTeamModal: false
showNewTeamModal: false,
});
}}
onSave={(newTeam) => {
this.props.teams.push(newTeam);
this.setState({
showNewTeamModal: false,
key: this.props.teams.length - 1
key: this.props.teams.length - 1,
});
this.render();
this.props.onTeamConfigChange(this.props.teams);
@ -379,7 +379,7 @@ const MainPage = createReactClass({
</div>
</div>
);
}
},
});
module.exports = MainPage;

View file

@ -25,7 +25,7 @@ const MattermostView = createReactClass({
active: PropTypes.bool,
withTab: PropTypes.bool,
useSpellChecker: PropTypes.bool,
onSelectSpellCheckerLocale: PropTypes.func
onSelectSpellCheckerLocale: PropTypes.func,
},
getInitialState() {
@ -33,7 +33,7 @@ const MattermostView = createReactClass({
errorInfo: null,
isContextMenuAdded: false,
reloadTimeoutID: null,
isLoaded: false
isLoaded: false,
};
},
@ -55,7 +55,7 @@ const MattermostView = createReactClass({
self.setState({
errorInfo: e,
isLoaded: true
isLoaded: true,
});
function reload() {
window.removeEventListener('online', reload);
@ -63,7 +63,7 @@ const MattermostView = createReactClass({
}
if (navigator.onLine) {
self.setState({
reloadTimeoutID: setTimeout(reload, 30000)
reloadTimeoutID: setTimeout(reload, 30000),
});
} else {
window.addEventListener('online', reload);
@ -105,7 +105,7 @@ const MattermostView = createReactClass({
this.props.onSelectSpellCheckerLocale(locale);
}
webview.send('set-spellcheker');
}
},
});
this.setState({isContextMenuAdded: true});
}
@ -121,7 +121,7 @@ const MattermostView = createReactClass({
switch (event.channel) {
case 'onGuestInitialized':
self.setState({
isLoaded: true
isLoaded: true,
});
break;
case 'onUnreadCountChange':
@ -142,7 +142,7 @@ const MattermostView = createReactClass({
webview.addEventListener('page-title-updated', (event) => {
if (self.props.active) {
ipcRenderer.send('update-title', {
title: event.title
title: event.title,
});
}
});
@ -171,7 +171,7 @@ const MattermostView = createReactClass({
this.setState({
errorInfo: null,
reloadTimeoutID: null,
isLoaded: false
isLoaded: false,
});
var webview = findDOMNode(this.refs.webview);
webview.reload();
@ -179,7 +179,7 @@ const MattermostView = createReactClass({
clearCacheAndReload() {
this.setState({
errorInfo: null
errorInfo: null,
});
var webContents = findDOMNode(this.refs.webview).getWebContents();
webContents.session.clearCache(() => {
@ -271,7 +271,7 @@ const MattermostView = createReactClass({
/>
{ loadingImage }
</div>);
}
},
});
module.exports = MattermostView;

View file

@ -10,7 +10,7 @@ class NewTeamModal extends React.Component {
this.state = {
teamName: '',
teamUrl: '',
saveStarted: false
saveStarted: false,
};
}
@ -23,7 +23,7 @@ class NewTeamModal extends React.Component {
teamName: this.props.team ? this.props.team.name : '',
teamUrl: this.props.team ? this.props.team.url : '',
teamIndex: this.props.team ? this.props.team.index : false,
saveStarted: false
saveStarted: false,
});
}
@ -40,7 +40,7 @@ class NewTeamModal extends React.Component {
handleTeamNameChange(e) {
this.setState({
teamName: e.target.value
teamName: e.target.value,
});
}
@ -63,7 +63,7 @@ class NewTeamModal extends React.Component {
handleTeamUrlChange(e) {
this.setState({
teamUrl: e.target.value
teamUrl: e.target.value,
});
}
@ -78,13 +78,13 @@ class NewTeamModal extends React.Component {
save() {
this.setState({
saveStarted: true
saveStarted: true,
}, () => {
if (this.validateForm()) {
this.props.onSave({
url: this.state.teamUrl,
name: this.state.teamName,
index: this.state.teamIndex
index: this.state.teamIndex,
});
}
});
@ -199,7 +199,7 @@ NewTeamModal.propTypes = {
onSave: PropTypes.func,
team: PropTypes.object,
editMode: PropTypes.bool,
show: PropTypes.bool
show: PropTypes.bool,
};
module.exports = NewTeamModal;

View file

@ -5,32 +5,32 @@ const {Button, Glyphicon, Popover} = require('react-bootstrap');
const PERMISSIONS = {
media: {
description: 'Use your camera and microphone',
glyph: 'facetime-video'
glyph: 'facetime-video',
},
geolocation: {
description: 'Know your location',
glyph: 'map-marker'
glyph: 'map-marker',
},
notifications: {
description: 'Show notifications',
glyph: 'bell'
glyph: 'bell',
},
midiSysex: {
description: 'Use your MIDI devices',
glyph: 'music'
glyph: 'music',
},
pointerLock: {
description: 'Lock your mouse cursor',
glyph: 'hand-up'
glyph: 'hand-up',
},
fullscreen: {
description: 'Enter full screen',
glyph: 'resize-full'
glyph: 'resize-full',
},
openExternal: {
description: 'Open external',
glyph: 'new-window'
}
glyph: 'new-window',
},
};
function glyph(permission) {
@ -83,7 +83,7 @@ PermissionRequestDialog.propTypes = {
permission: PropTypes.oneOf(['media', 'geolocation', 'notifications', 'midiSysex', 'pointerLock', 'fullscreen', 'openExternal']),
onClickAllow: PropTypes.func,
onClickBlock: PropTypes.func,
onClickClose: PropTypes.func
onClickClose: PropTypes.func,
};
module.exports = PermissionRequestDialog;

View file

@ -27,7 +27,7 @@ function RemoveServerModal(props) {
}
RemoveServerModal.propTypes = {
serverName: PropTypes.string.isRequired
serverName: PropTypes.string.isRequired,
};
module.exports = RemoveServerModal;

View file

@ -16,7 +16,7 @@ const AutoSaveIndicator = require('./AutoSaveIndicator.jsx');
const appLauncher = new AutoLaunch({
name: remote.app.getName(),
isHidden: true
isHidden: true,
});
function backToIndex(index) {
@ -31,7 +31,7 @@ const CONFIG_TYPE_APP_OPTIONS = 'appOptions';
const SettingsPage = createReactClass({
propTypes: {
configFile: PropTypes.string,
enableServerManagement: PropTypes.bool
enableServerManagement: PropTypes.bool,
},
getInitialState() {
@ -49,7 +49,7 @@ const SettingsPage = createReactClass({
}
initialState.savingState = {
appOptions: AutoSaveIndicator.SAVING_STATE_DONE,
servers: AutoSaveIndicator.SAVING_STATE_DONE
servers: AutoSaveIndicator.SAVING_STATE_DONE,
};
return initialState;
@ -59,13 +59,13 @@ const SettingsPage = createReactClass({
var self = this;
appLauncher.isEnabled().then((enabled) => {
self.setState({
autostart: enabled
autostart: enabled,
});
});
}
ipcRenderer.on('add-server', () => {
this.setState({
showAddTeamForm: true
showAddTeamForm: true,
});
});
ipcRenderer.on('switch-tab', (event, key) => {
@ -113,7 +113,7 @@ const SettingsPage = createReactClass({
handleTeamsChange(teams) {
this.setState({
showAddTeamForm: false,
teams
teams,
});
if (teams.length === 0) {
this.setState({showAddTeamForm: true});
@ -131,11 +131,11 @@ const SettingsPage = createReactClass({
notifications: {
flashWindow: this.state.notifications.flashWindow,
bounceIcon: this.state.notifications.bounceIcon,
bounceIconType: this.state.notifications.bounceIconType
bounceIconType: this.state.notifications.bounceIconType,
},
showUnreadBadge: this.state.showUnreadBadge,
useSpellChecker: this.state.useSpellChecker,
spellCheckerLocale: this.state.spellCheckerLocale
spellCheckerLocale: this.state.spellCheckerLocale,
};
settings.writeFile(this.props.configFile, config, (err) => {
@ -176,12 +176,12 @@ const SettingsPage = createReactClass({
handleChangeShowTrayIcon() {
var shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
this.setState({
showTrayIcon: shouldShowTrayIcon
showTrayIcon: shouldShowTrayIcon,
});
if (process.platform === 'darwin' && !shouldShowTrayIcon) {
this.setState({
minimizeToTray: false
minimizeToTray: false,
});
}
@ -189,13 +189,13 @@ const SettingsPage = createReactClass({
},
handleChangeTrayIconTheme() {
this.setState({
trayIconTheme: ReactDOM.findDOMNode(this.refs.trayIconTheme).value
trayIconTheme: ReactDOM.findDOMNode(this.refs.trayIconTheme).value,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
handleChangeAutoStart() {
this.setState({
autostart: !this.refs.autostart.props.checked
autostart: !this.refs.autostart.props.checked,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
@ -203,27 +203,27 @@ const SettingsPage = createReactClass({
const shouldMinimizeToTray = this.state.showTrayIcon && !this.refs.minimizeToTray.props.checked;
this.setState({
minimizeToTray: shouldMinimizeToTray
minimizeToTray: shouldMinimizeToTray,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
toggleShowTeamForm() {
this.setState({
showAddTeamForm: !this.state.showAddTeamForm
showAddTeamForm: !this.state.showAddTeamForm,
});
document.activeElement.blur();
},
setShowTeamFormVisibility(val) {
this.setState({
showAddTeamForm: val
showAddTeamForm: val,
});
},
handleFlashWindow() {
this.setState({
notifications: {
...this.state.notifications,
flashWindow: this.refs.flashWindow.props.checked ? 0 : 2
}
flashWindow: this.refs.flashWindow.props.checked ? 0 : 2,
},
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
@ -231,8 +231,8 @@ const SettingsPage = createReactClass({
this.setState({
notifications: {
...this.state.notifications,
bounceIcon: !this.refs.bounceIcon.props.checked
}
bounceIcon: !this.refs.bounceIcon.props.checked,
},
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
@ -240,21 +240,21 @@ const SettingsPage = createReactClass({
this.setState({
notifications: {
...this.state.notifications,
bounceIconType: event.target.value
}
bounceIconType: event.target.value,
},
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
handleShowUnreadBadge() {
this.setState({
showUnreadBadge: !this.refs.showUnreadBadge.props.checked
showUnreadBadge: !this.refs.showUnreadBadge.props.checked,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
handleChangeUseSpellChecker() {
this.setState({
useSpellChecker: !this.refs.useSpellChecker.props.checked
useSpellChecker: !this.refs.useSpellChecker.props.checked,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
},
@ -263,7 +263,7 @@ const SettingsPage = createReactClass({
var teams = this.state.teams;
teams[index] = newData;
this.setState({
teams
teams,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
},
@ -272,7 +272,7 @@ const SettingsPage = createReactClass({
var teams = this.state.teams;
teams.push(team);
this.setState({
teams
teams,
});
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
},
@ -280,7 +280,7 @@ const SettingsPage = createReactClass({
render() {
const settingsPage = {
navbar: {
backgroundColor: '#fff'
backgroundColor: '#fff',
},
close: {
textDecoration: 'none',
@ -289,28 +289,28 @@ const SettingsPage = createReactClass({
top: '5px',
fontSize: '35px',
fontWeight: 'normal',
color: '#bbb'
color: '#bbb',
},
heading: {
textAlign: 'center',
fontSize: '24px',
margin: '0',
padding: '1em 0'
padding: '1em 0',
},
sectionHeading: {
fontSize: '20px',
margin: '0',
padding: '1em 0',
float: 'left'
float: 'left',
},
sectionHeadingLink: {
marginTop: '24px',
display: 'inline-block',
fontSize: '15px'
fontSize: '15px',
},
footer: {
padding: '0.4em 0'
}
padding: '0.4em 0',
},
};
var teamsRow = (
@ -598,7 +598,7 @@ const SettingsPage = createReactClass({
</Grid>
</div>
);
}
},
});
module.exports = SettingsPage;

View file

@ -108,10 +108,10 @@ TabBar.propTypes = {
showAddServerButton: PropTypes.bool,
requestingPermission: PropTypes.arrayOf(PropTypes.shape({
origin: PropTypes.string,
permission: PropTypes.string
permission: PropTypes.string,
})),
onAddServer: PropTypes.func,
onClickPermissionDialog: PropTypes.func
onClickPermissionDialog: PropTypes.func,
};
module.exports = TabBar;

View file

@ -15,7 +15,7 @@ const TeamList = createReactClass({
updateTeam: PropTypes.func,
toggleAddTeamForm: PropTypes.func,
setAddTeamFormVisibility: PropTypes.func,
onTeamClick: PropTypes.func
onTeamClick: PropTypes.func,
},
getInitialState() {
@ -25,8 +25,8 @@ const TeamList = createReactClass({
team: {
url: '',
name: '',
index: false
}
index: false,
},
};
},
handleTeamRemove(index) {
@ -51,8 +51,8 @@ const TeamList = createReactClass({
team: {
url: '',
name: '',
index: false
}
index: false,
},
});
this.props.onTeamsChange(teams);
@ -63,8 +63,8 @@ const TeamList = createReactClass({
team: {
url: teamUrl,
name: teamName,
index: teamIndex
}
index: teamIndex,
},
});
},
@ -116,15 +116,15 @@ const TeamList = createReactClass({
team: {
name: '',
url: '',
index: false
}
index: false,
},
});
this.props.setAddTeamFormVisibility(false);
}}
onSave={(newTeam) => {
var teamData = {
name: newTeam.name,
url: newTeam.url
url: newTeam.url,
};
if (this.props.showAddTeamForm) {
this.props.addServer(teamData);
@ -137,8 +137,8 @@ const TeamList = createReactClass({
team: {
name: '',
url: '',
index: false
}
index: false,
},
});
this.render();
this.props.setAddTeamFormVisibility(false);
@ -167,7 +167,7 @@ const TeamList = createReactClass({
{ removeServerModal}
</ListGroup>
);
}
},
});
module.exports = TeamList;

View file

@ -47,7 +47,7 @@ TeamListItem.propTypes = {
onTeamEditing: PropTypes.func,
onTeamRemove: PropTypes.func,
onTeamClick: PropTypes.func,
url: PropTypes.string
url: PropTypes.string,
};
module.exports = TeamListItem;

View file

@ -8,7 +8,7 @@ class AppConfig {
this.data = settings.readFileSync(file);
} catch (e) {
this.data = {
teams: []
teams: [],
};
}
}

View file

@ -35,7 +35,7 @@ function showUnreadBadgeWindows(unreadCount, mentionCount) {
overlayDataURL: dataURL,
description,
unreadCount,
mentionCount
mentionCount,
});
}
@ -61,7 +61,7 @@ function showUnreadBadgeOSX(unreadCount, mentionCount) {
ipcRenderer.send('update-unread', {
unreadCount,
mentionCount
mentionCount,
});
}
@ -72,7 +72,7 @@ function showUnreadBadgeLinux(unreadCount, mentionCount) {
ipcRenderer.send('update-unread', {
unreadCount,
mentionCount
mentionCount,
});
}

View file

@ -25,5 +25,5 @@ function createDataURL(text) {
}
module.exports = {
createDataURL
createDataURL,
};

View file

@ -5,14 +5,14 @@ function getSuggestionsMenus(win, suggestions) {
if (suggestions.length === 0) {
return [{
label: 'No Suggestions',
enabled: false
enabled: false,
}];
}
return suggestions.map((s) => ({
label: s,
click() {
(win.webContents || win.getWebContents()).replaceMisspelling(s);
}
},
}));
}
@ -23,7 +23,7 @@ function getSpellCheckerLocaleMenus(onSelectSpellCheckerLocale) {
{language: 'French', locale: 'fr-FR'},
{language: 'German', locale: 'de-DE'},
{language: 'Spanish', locale: 'es-ES'},
{language: 'Dutch', locale: 'nl-NL'}
{language: 'Dutch', locale: 'nl-NL'},
];
return locales.map((l) => ({
label: l.language,
@ -33,7 +33,7 @@ function getSpellCheckerLocaleMenus(onSelectSpellCheckerLocale) {
if (onSelectSpellCheckerLocale) {
onSelectSpellCheckerLocale(l.locale);
}
}
},
}));
}
@ -41,7 +41,7 @@ module.exports = {
setup(win, options) {
const defaultOptions = {
useSpellChecker: false,
onSelectSpellCheckerLocale: null
onSelectSpellCheckerLocale: null,
};
const actualOptions = Object.assign({}, defaultOptions, options);
electronContextMenu({
@ -61,7 +61,7 @@ module.exports = {
return prependMenuItems;
}
return [];
}
},
});
}
},
};

View file

@ -27,7 +27,7 @@ class EnhancedNotification extends OriginalNotification {
ipcRenderer.send('notified', {
title,
options
options,
});
if (process.platform === 'win32' && osVersion.isLowerThanOrEqualWindows8_1()) {

View file

@ -178,7 +178,7 @@ function setSpellChecker() {
spellCheck(text) {
const res = ipc.sendSync('checkspell', text);
return res === null ? true : res;
}
},
});
resetMisspelledState();
}

View file

@ -17,7 +17,7 @@ const buildConfig = {
}*/
],
helpLink: 'https://about.mattermost.com/default-desktop-app-documentation/',
enableServerManagement: true
enableServerManagement: true,
};
module.exports = buildConfig;

View file

@ -11,11 +11,11 @@ const defaultPreferences = {
notifications: {
flashWindow: 0,
bounceIcon: false,
bounceIconType: 'informational'
bounceIconType: 'informational',
},
showUnreadBadge: true,
useSpellChecker: true,
spellCheckerLocale: 'en-US'
spellCheckerLocale: 'en-US',
};
module.exports = defaultPreferences;

View file

@ -2,8 +2,8 @@ const defaultPreferences = require('./defaultPreferences');
const pastDefaultPreferences = {
0: {
url: ''
}
url: '',
},
};
pastDefaultPreferences[`${defaultPreferences.version}`] = defaultPreferences;

View file

@ -11,7 +11,7 @@ function upgradeV0toV1(configV0) {
}
config.teams.push({
name: 'Primary team',
url: configV0.url
url: configV0.url,
});
return config;
}

View file

@ -13,5 +13,5 @@ module.exports = {
// consider Windows 7 and later.
return (this.major <= 6 && this.minor <= 3);
}
},
};

View file

@ -14,7 +14,7 @@ const upgradePreferences = require('./config/upgradePreferences');
function loadDefault(spellCheckerLocale) {
const config = JSON.parse(JSON.stringify(defaultPreferences));
return Object.assign({}, config, {
spellCheckerLocale: spellCheckerLocale || defaultPreferences.spellCheckerLocale || 'en-US'
spellCheckerLocale: spellCheckerLocale || defaultPreferences.spellCheckerLocale || 'en-US',
});
}
@ -73,5 +73,5 @@ module.exports = {
newTeams.push(...JSON.parse(JSON.stringify(teams)));
}
return newTeams;
}
},
};

View file

@ -8,7 +8,7 @@ const {
nativeImage,
dialog,
systemPreferences,
session
session,
} = require('electron');
const os = require('os');
const path = require('path');
@ -114,7 +114,7 @@ const trayImages = (() => {
return {
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray.ico')),
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_unread.ico')),
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico'))
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico')),
};
case 'darwin':
{
@ -122,13 +122,13 @@ const trayImages = (() => {
light: {
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIcon.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: {
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIcon.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());
return icons;
@ -140,14 +140,14 @@ const trayImages = (() => {
return {
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.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) {
//Fallback for invalid theme setting
return {
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconTemplate.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')),
};
}
}
@ -250,7 +250,7 @@ function handleScreenResize(screen, browserWindow) {
x: position[0],
y: position[1],
width: size[0],
height: size[1]
height: size[1],
}, screen);
browserWindow.setPosition(validPosition.x || 0, validPosition.y || 0);
}
@ -295,9 +295,9 @@ app.on('certificate-error', (event, webContents, url, error, certificate, callba
type: 'warning',
buttons: [
'Yes',
'No'
'No',
],
cancelId: 1
cancelId: 1,
}, (response) => {
if (response === 0) {
certificateStore.add(url, certificate);
@ -335,7 +335,7 @@ ipcMain.on('download-url', (event, URL) => {
if (err) {
dialog.showMessageBox(mainWindow, {
type: 'error',
message: err.toString()
message: err.toString(),
});
console.log(err);
}
@ -411,7 +411,7 @@ app.on('ready', () => {
mainWindow = createMainWindow(config, {
hideOnStartup,
linuxAppIcon: path.join(assetsDir, 'appicon.png'),
deeplinkingUrl
deeplinkingUrl,
});
mainWindow.on('closed', () => {
@ -528,7 +528,7 @@ app.on('ready', () => {
var filename = item.getFilename();
var savePath = dialog.showSaveDialog({
title: filename,
defaultPath: os.homedir() + '/Downloads/' + filename
defaultPath: os.homedir() + '/Downloads/' + filename,
});
if (savePath) {

View file

@ -50,7 +50,7 @@ class CriticalErrorHandler {
title: app.getName(),
message: 'The window is no longer responsive.\nDo you wait until the window becomes responsive again?',
buttons: ['No', 'Yes'],
defaultId: 0
defaultId: 0,
});
if (result === 0) {
throw new Error('BrowserWindow \'unresponsive\' event has been emitted');
@ -74,7 +74,7 @@ class CriticalErrorHandler {
message: `The ${app.getName()} app quit unexpectedly. Click "Show Details" to learn more or "Reopen" to open the application again.\n\nInternal error: ${err.message}`,
buttons,
defaultId: buttons.indexOf(BUTTON_REOPEN),
noLink: true
noLink: true,
});
switch (result) {
case buttons.indexOf(BUTTON_SHOW_DETAILS):

View file

@ -17,7 +17,7 @@ const contractions = [
"there're", "there's", "they'd", "they'd've", "they'll", "they're", "they've", "wasn't", "we'd", "we'd've",
"we'll", "we're", "we've", "weren't", "what'll", "what're", "what's", "what've", "when's", "where'd",
"where's", "where've", "who'd", "who'll", "who're", "who's", "who've", "why'll", "why're", "why's", "won't",
"would've", "wouldn't", "wouldn't've", "y'all", "y'all'd've", "you'd", "you'd've", "you'll", "you're", "you've"
"would've", "wouldn't", "wouldn't've", "y'all", "y'all'd've", "you'd", "you'd've", "you'll", "you're", "you've",
];
const contractionMap = contractions.reduce((acc, word) => {

View file

@ -4,7 +4,7 @@ const {
app,
dialog,
ipcMain,
shell
shell,
} = require('electron');
const path = require('path');
const fs = require('fs');
@ -35,10 +35,10 @@ function initDialogEvent(mainWindow) {
buttons: [
'Yes',
`Yes (Save ${protocol} as allowed)`,
'No'
'No',
],
cancelId: 2,
noLink: true
noLink: true,
}, (response) => {
switch (response) {
case 1: {
@ -63,5 +63,5 @@ function initDialogEvent(mainWindow) {
}
module.exports = {
init
init,
};

View file

@ -6,7 +6,7 @@ const url = require('url');
function comparableCertificate(certificate) {
return {
data: certificate.data.toString(),
issuerName: certificate.issuerName
issuerName: certificate.issuerName,
};
}
@ -63,5 +63,5 @@ CertificateStore.prototype.isTrusted = function isTrusted(targetURL, certificate
module.exports = {
load(storeFile) {
return new CertificateStore(storeFile);
}
},
};

View file

@ -11,7 +11,7 @@ function downloadURL(browserWindow, URL, callback) {
request.on('response', (response) => {
const file = getAttachmentName(response.headers);
const dialogOptions = {
defaultPath: path.join(app.getPath('downloads'), file)
defaultPath: path.join(app.getPath('downloads'), file),
};
dialog.showSaveDialog(browserWindow, dialogOptions, (filename) => {
if (filename) {

View file

@ -38,7 +38,7 @@ function createMainWindow(config, options) {
fullscreenable: true,
show: false,
minWidth: minimumWindowWidth,
minHeight: minimumWindowHeight
minHeight: minimumWindowHeight,
});
const mainWindow = new BrowserWindow(windowOptions);

View file

@ -10,7 +10,7 @@ function createTemplate(mainWindow, config, isDev) {
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${electron.app.getAppPath()}/browser/settings.html`;
const separatorItem = {
type: 'separator'
type: 'separator',
};
var appName = electron.app.getName();
@ -23,21 +23,21 @@ function createTemplate(mainWindow, config, isDev) {
click() {
electron.dialog.showMessageBox(mainWindow, {
buttons: ['OK'],
message: `${appName} Desktop ${electron.app.getVersion()}`
message: `${appName} Desktop ${electron.app.getVersion()}`,
});
}
},
}, separatorItem, {
label: 'Preferences...',
accelerator: 'CmdOrCtrl+,',
click() {
mainWindow.loadURL(settingsURL);
}
},
}] : [{
label: 'Settings...',
accelerator: 'CmdOrCtrl+,',
click() {
mainWindow.loadURL(settingsURL);
}
},
}];
if (buildConfig.enableServerManagement === true) {
@ -45,49 +45,49 @@ function createTemplate(mainWindow, config, isDev) {
label: 'Sign in to Another Server',
click() {
mainWindow.webContents.send('add-server');
}
},
});
}
platformAppMenu = platformAppMenu.concat(process.platform === 'darwin' ? [
separatorItem, {
role: 'hide'
role: 'hide',
}, {
role: 'hideothers'
role: 'hideothers',
}, {
role: 'unhide'
role: 'unhide',
}, separatorItem, {
role: 'quit'
role: 'quit',
}] : [separatorItem, {
role: 'quit',
accelerator: 'CmdOrCtrl+Q',
click() {
electron.app.quit();
}
},
}]
);
template.push({
label: '&' + firstMenuName,
submenu: [
...platformAppMenu
]
...platformAppMenu,
],
});
template.push({
label: '&Edit',
submenu: [{
role: 'undo'
role: 'undo',
}, {
role: 'redo'
role: 'redo',
}, separatorItem, {
role: 'cut'
role: 'cut',
}, {
role: 'copy'
role: 'copy',
}, {
role: 'paste'
role: 'paste',
}, {
role: 'selectall'
}]
role: 'selectall',
}],
});
template.push({
label: '&View',
@ -102,7 +102,7 @@ function createTemplate(mainWindow, config, isDev) {
focusedWindow.reload();
}
}
}
},
}, {
label: 'Clear Cache and Reload',
accelerator: 'Shift+CmdOrCtrl+R',
@ -116,25 +116,25 @@ function createTemplate(mainWindow, config, isDev) {
});
}
}
}
},
}, {
role: 'togglefullscreen'
role: 'togglefullscreen',
}, separatorItem, {
role: 'resetzoom'
role: 'resetzoom',
}, {
role: 'zoomin'
role: 'zoomin',
}, {
label: 'Zoom In (hidden)',
accelerator: 'CmdOrCtrl+=',
visible: false,
role: 'zoomin'
role: 'zoomin',
}, {
role: 'zoomout'
role: 'zoomout',
}, {
label: 'Zoom Out (hidden)',
accelerator: 'CmdOrCtrl+Shift+-',
visible: false,
role: 'zoomout'
role: 'zoomout',
}, separatorItem, {
label: 'Toggle Developer Tools',
accelerator: (() => {
@ -147,8 +147,8 @@ function createTemplate(mainWindow, config, isDev) {
if (focusedWindow) {
focusedWindow.toggleDevTools();
}
}
}]
},
}],
});
template.push({
label: '&History',
@ -161,7 +161,7 @@ function createTemplate(mainWindow, config, isDev) {
} else if (focusedWindow.webContents.canGoBack()) {
focusedWindow.goBack();
}
}
},
}, {
label: 'Forward',
accelerator: process.platform === 'darwin' ? 'Cmd+]' : 'Alt+Right',
@ -171,17 +171,17 @@ function createTemplate(mainWindow, config, isDev) {
} else if (focusedWindow.webContents.canGoForward()) {
focusedWindow.goForward();
}
}
}]
},
}],
});
const teams = settings.mergeDefaultTeams(config.teams);
const windowMenu = {
label: '&Window',
submenu: [{
role: 'minimize'
role: 'minimize',
}, {
role: 'close'
role: 'close',
}, separatorItem, ...teams.slice(0, 9).map((team, i) => {
return {
label: team.name,
@ -189,7 +189,7 @@ function createTemplate(mainWindow, config, isDev) {
click() {
mainWindow.show(); // for OS X
mainWindow.webContents.send('switch-tab', i);
}
},
};
}), separatorItem, {
label: 'Select Next Server',
@ -197,15 +197,15 @@ function createTemplate(mainWindow, config, isDev) {
click() {
mainWindow.webContents.send('select-next-tab');
},
enabled: (teams.length > 1)
enabled: (teams.length > 1),
}, {
label: 'Select Previous Server',
accelerator: 'Ctrl+Shift+Tab',
click() {
mainWindow.webContents.send('select-previous-tab');
},
enabled: (teams.length > 1)
}]
enabled: (teams.length > 1),
}],
};
template.push(windowMenu);
var submenu = [];
@ -214,13 +214,13 @@ function createTemplate(mainWindow, config, isDev) {
label: 'Learn More...',
click() {
electron.shell.openExternal(buildConfig.helpLink);
}
},
});
submenu.push(separatorItem);
}
submenu.push({
label: `Version ${electron.app.getVersion()}`,
enabled: false
enabled: false,
});
template.push({label: '&Help', submenu});
return template;
@ -231,5 +231,5 @@ function createMenu(mainWindow, config, isDev) {
}
module.exports = {
createMenu
createMenu,
};

View file

@ -2,7 +2,7 @@
const {
app,
Menu
Menu,
} = require('electron');
const settings = require('../../common/settings');
@ -21,10 +21,10 @@ function createTemplate(mainWindow, config, isDev) {
app.dock.show();
mainWindow.focus();
}
}
},
};
}), {
type: 'separator'
type: 'separator',
}, {
label: process.platform === 'darwin' ? 'Preferences...' : 'Settings',
click: () => {
@ -35,12 +35,12 @@ function createTemplate(mainWindow, config, isDev) {
app.dock.show();
mainWindow.focus();
}
}
},
}, {
type: 'separator'
type: 'separator',
}, {
role: 'quit'
}
role: 'quit',
},
];
return template;
}
@ -58,5 +58,5 @@ function showOrRestore(window) {
}
module.exports = {
createMenu
createMenu,
};

View file

@ -49,7 +49,7 @@ function permissionRequestHandler(mainWindow, permissionManager) {
requestQueue.push({
origin: targetURL.origin,
permission,
callback
callback,
});
mainWindow.webContents.send('request-permission', targetURL.origin, permission);
};

View file

@ -11,7 +11,7 @@ function shouldQuitApp(cmd) {
async function setupAutoLaunch(cmd) {
const appLauncher = new AutoLaunch({
name: app.getName(),
isHidden: true
isHidden: true,
});
if (cmd === '--squirrel-uninstall') {
// If we're uninstalling, make sure we also delete our auto launch registry key

View file

@ -48,7 +48,7 @@ module.exports = {
getSpectronApp() {
return new Application({
path: electronBinaryPath,
args: [`${path.join(sourceRootDir, 'src')}`, `--data-dir=${userDataDir}`, '--disable-dev-mode']
args: [`${path.join(sourceRootDir, 'src')}`, `--data-dir=${userDataDir}`, '--disable-dev-mode'],
});
},
@ -78,5 +78,5 @@ module.exports = {
},
isOneOf(platforms) {
return (platforms.indexOf(process.platform) !== -1);
}
},
};

View file

@ -80,7 +80,7 @@ describe('application', function desc() {
it('should show index.html when there is config file', () => {
fs.writeFileSync(env.configFilePath, JSON.stringify({
url: env.mattermostURL
url: env.mattermostURL,
}));
return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().getUrl();
@ -92,7 +92,7 @@ describe('application', function desc() {
it('should upgrade v0 config file', () => {
const settings = require('../../src/common/settings');
fs.writeFileSync(env.configFilePath, JSON.stringify({
url: env.mattermostURL
url: env.mattermostURL,
}));
return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().getUrl();

View file

@ -13,11 +13,11 @@ describe('browser/index.html', function desc() {
version: 1,
teams: [{
name: 'example',
url: env.mattermostURL
url: env.mattermostURL,
}, {
name: 'github',
url: 'https://github.com/'
}]
url: 'https://github.com/',
}],
};
const serverPort = 8181;
@ -25,7 +25,7 @@ describe('browser/index.html', function desc() {
before(() => {
function serverCallback(req, res) {
res.writeHead(200, {
'Content-Type': 'text/html'
'Content-Type': 'text/html',
});
res.end(fs.readFileSync(path.resolve(env.sourceRootDir, 'test/modules/test.html'), 'utf-8'));
}
@ -51,7 +51,7 @@ describe('browser/index.html', function desc() {
it('should NOT show tabs when there is one team', () => {
fs.writeFileSync(env.configFilePath, JSON.stringify({
url: env.mattermostURL
url: env.mattermostURL,
}));
return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().
@ -99,8 +99,8 @@ describe('browser/index.html', function desc() {
version: 1,
teams: [{
name: 'error_1',
url: 'http://false'
}]
url: 'http://false',
}],
}));
return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().
@ -113,8 +113,8 @@ describe('browser/index.html', function desc() {
version: 1,
teams: [{
name: 'title_test',
url: `http://localhost:${serverPort}`
}]
url: `http://localhost:${serverPort}`,
}],
}));
return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().pause(2000);
@ -131,11 +131,11 @@ describe('browser/index.html', function desc() {
version: 1,
teams: [{
name: 'title_test_0',
url: `http://localhost:${serverPort}`
url: `http://localhost:${serverPort}`,
}, {
name: 'title_test_1',
url: `http://localhost:${serverPort}`
}]
url: `http://localhost:${serverPort}`,
}],
}));
return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().pause(500);
@ -170,11 +170,11 @@ describe('browser/index.html', function desc() {
version: 1,
teams: [{
name: 'title_test_0',
url: `http://localhost:${serverPort}`
url: `http://localhost:${serverPort}`,
}, {
name: 'title_test_1',
url: `http://localhost:${serverPort}`
}]
url: `http://localhost:${serverPort}`,
}],
}));
return this.app.restart().then(() => {
// Note: Indices of webview are correct.

View file

@ -11,11 +11,11 @@ describe('browser/settings.html', function desc() {
version: 1,
teams: [{
name: 'example',
url: env.mattermostURL
url: env.mattermostURL,
}, {
name: 'github',
url: 'https://github.com/'
}]
url: 'https://github.com/',
}],
};
beforeEach(() => {
@ -473,7 +473,7 @@ describe('browser/settings.html', function desc() {
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
savedConfig.teams.should.deep.contain({
name: 'TestTeam',
url: 'http://example.org'
url: 'http://example.org',
});
done();
}).catch((err) => {

View file

@ -54,22 +54,22 @@ describe('PermissionManager', function() {
manager.grant(ORIGIN + '_another', PERMISSION + '_another');
JSON.parse(fs.readFileSync(permissionFile)).should.deep.equal({
origin: {
permission: 'denied'
permission: 'denied',
},
origin_another: {
permission_another: 'granted'
}
permission_another: 'granted',
},
});
});
it('should restore permissions from the file', function() {
fs.writeFileSync(permissionFile, JSON.stringify({
origin: {
permission: 'denied'
permission: 'denied',
},
origin_another: {
permission_another: 'granted'
}
permission_another: 'granted',
},
}));
const manager = new PermissionManager(permissionFile);
manager.isDenied('origin', 'permission').should.be.true;

View file

@ -16,17 +16,17 @@ describe('application', function desc() {
version: 1,
teams: [{
name: 'example_1',
url: testURL
url: testURL,
}, {
name: 'example_2',
url: testURL
}]
url: testURL,
}],
};
before(() => {
this.server = http.createServer((req, res) => {
res.writeHead(200, {
'Content-Type': 'text/html'
'Content-Type': 'text/html',
});
res.end(fs.readFileSync(path.resolve(env.sourceRootDir, 'test/modules/test.html'), 'utf-8'));
}).listen(serverPort, '127.0.0.1');
@ -114,7 +114,7 @@ describe('application', function desc() {
};
return Promise.all([
tryEval(0),
tryEvalInSettingsPage()
tryEvalInSettingsPage(),
]);
});
});

View file

@ -6,7 +6,7 @@ const pastDefaultPreferences = require('../../src/common/config/pastDefaultPrefe
describe('common/settings.js', () => {
it('should upgrade v0 config file', () => {
const v0Config = {
url: 'https://example.com/team'
url: 'https://example.com/team',
};
const config = settings.upgrade(v0Config);
config.teams.length.should.equal(1);
@ -18,17 +18,17 @@ describe('common/settings.js', () => {
const teams = [
{
name: 'test',
url: 'https://example.com'
}
url: 'https://example.com',
},
];
const mergedTeams = settings.mergeDefaultTeams(teams);
mergedTeams.should.deep.equal([
{
name: 'test',
url: 'https://example.com'
url: 'https://example.com',
},
...buildConfig.defaultTeams
...buildConfig.defaultTeams,
]);
});
});

View file

@ -3,5 +3,5 @@
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
devtool: isProduction ? false : '#inline-source-map'
devtool: isProduction ? false : '#inline-source-map',
};

View file

@ -6,11 +6,11 @@ const base = require('./webpack.config.base');
module.exports = merge(base, {
entry: './src/main.js',
output: {
filename: './src/[name]_bundle.js'
filename: './src/[name]_bundle.js',
},
node: {
__filename: true,
__dirname: true
__dirname: true,
},
target: 'electron-main'
target: 'electron-main',
});

View file

@ -8,40 +8,40 @@ module.exports = merge(base, {
entry: {
index: './src/browser/index.jsx',
settings: './src/browser/settings.jsx',
'webview/mattermost': './src/browser/webview/mattermost.js'
'webview/mattermost': './src/browser/webview/mattermost.js',
},
output: {
path: path.join(__dirname, 'src/browser'),
publicPath: 'browser',
filename: '[name]_bundle.js'
filename: '[name]_bundle.js',
},
module: {
rules: [{
test: /\.jsx$/,
use: {
loader: 'babel-loader'
}
loader: 'babel-loader',
},
}, {
test: /\.css$/,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'}
]
{loader: 'css-loader'},
],
}, {
test: /\.mp3$/,
use: {
loader: 'url-loader'
}
}]
loader: 'url-loader',
},
}],
},
node: {
__filename: true,
__dirname: true
__dirname: true,
},
target: 'electron-renderer',
devServer: {
contentBase: path.join(__dirname, 'src'),
inline: true,
publicPath: '/browser/'
}
publicPath: '/browser/',
},
});