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
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) { if (config.enableServerManagement === false && config.defaultTeams && config.defaultTeams.length === 0) {
return { return {
result: false, 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}; return {result: true};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,7 +14,7 @@ const upgradePreferences = require('./config/upgradePreferences');
function loadDefault(spellCheckerLocale) { function loadDefault(spellCheckerLocale) {
const config = JSON.parse(JSON.stringify(defaultPreferences)); const config = JSON.parse(JSON.stringify(defaultPreferences));
return Object.assign({}, config, { 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))); newTeams.push(...JSON.parse(JSON.stringify(teams)));
} }
return newTeams; return newTeams;
} },
}; };

View File

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

View File

@@ -50,7 +50,7 @@ class CriticalErrorHandler {
title: app.getName(), title: app.getName(),
message: 'The window is no longer responsive.\nDo you wait until the window becomes responsive again?', message: 'The window is no longer responsive.\nDo you wait until the window becomes responsive again?',
buttons: ['No', 'Yes'], buttons: ['No', 'Yes'],
defaultId: 0 defaultId: 0,
}); });
if (result === 0) { if (result === 0) {
throw new Error('BrowserWindow \'unresponsive\' event has been emitted'); 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}`, 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, buttons,
defaultId: buttons.indexOf(BUTTON_REOPEN), defaultId: buttons.indexOf(BUTTON_REOPEN),
noLink: true noLink: true,
}); });
switch (result) { switch (result) {
case buttons.indexOf(BUTTON_SHOW_DETAILS): 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", "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", "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", "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) => { const contractionMap = contractions.reduce((acc, word) => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,7 @@ function shouldQuitApp(cmd) {
async function setupAutoLaunch(cmd) { async function setupAutoLaunch(cmd) {
const appLauncher = new AutoLaunch({ const appLauncher = new AutoLaunch({
name: app.getName(), name: app.getName(),
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

View File

@@ -48,7 +48,7 @@ module.exports = {
getSpectronApp() { getSpectronApp() {
return new Application({ return new Application({
path: electronBinaryPath, 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) { isOneOf(platforms) {
return (platforms.indexOf(process.platform) !== -1); 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', () => { it('should show index.html when there is config file', () => {
fs.writeFileSync(env.configFilePath, JSON.stringify({ fs.writeFileSync(env.configFilePath, JSON.stringify({
url: env.mattermostURL url: env.mattermostURL,
})); }));
return this.app.restart().then(() => { return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().getUrl(); return this.app.client.waitUntilWindowLoaded().getUrl();
@@ -92,7 +92,7 @@ describe('application', function desc() {
it('should upgrade v0 config file', () => { it('should upgrade v0 config file', () => {
const settings = require('../../src/common/settings'); const settings = require('../../src/common/settings');
fs.writeFileSync(env.configFilePath, JSON.stringify({ fs.writeFileSync(env.configFilePath, JSON.stringify({
url: env.mattermostURL url: env.mattermostURL,
})); }));
return this.app.restart().then(() => { return this.app.restart().then(() => {
return this.app.client.waitUntilWindowLoaded().getUrl(); return this.app.client.waitUntilWindowLoaded().getUrl();

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@ const pastDefaultPreferences = require('../../src/common/config/pastDefaultPrefe
describe('common/settings.js', () => { describe('common/settings.js', () => {
it('should upgrade v0 config file', () => { it('should upgrade v0 config file', () => {
const v0Config = { const v0Config = {
url: 'https://example.com/team' url: 'https://example.com/team',
}; };
const config = settings.upgrade(v0Config); const config = settings.upgrade(v0Config);
config.teams.length.should.equal(1); config.teams.length.should.equal(1);
@@ -18,17 +18,17 @@ describe('common/settings.js', () => {
const teams = [ const teams = [
{ {
name: 'test', name: 'test',
url: 'https://example.com' url: 'https://example.com',
} },
]; ];
const mergedTeams = settings.mergeDefaultTeams(teams); const mergedTeams = settings.mergeDefaultTeams(teams);
mergedTeams.should.deep.equal([ mergedTeams.should.deep.equal([
{ {
name: 'test', 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'; const isProduction = process.env.NODE_ENV === 'production';
module.exports = { 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, { module.exports = merge(base, {
entry: './src/main.js', entry: './src/main.js',
output: { output: {
filename: './src/[name]_bundle.js' filename: './src/[name]_bundle.js',
}, },
node: { node: {
__filename: true, __filename: true,
__dirname: true __dirname: true,
}, },
target: 'electron-main' target: 'electron-main',
}); });

View File

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