Minor fixes based on lgtm.com alerts (#6819)
* Remove a couple of superfluous trailing arguments * Simplify assignment logic in a couple of places * Modify some potentially inconsistent setState calls to use the function form * Fix eslint errors
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
e6ca2974cd
Коммит
b03b9d7362
@@ -38,8 +38,8 @@ export default class ManageTeamsDropdown extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleDropdown() {
|
toggleDropdown() {
|
||||||
this.setState({
|
this.setState((prevState) => {
|
||||||
show: !this.state.show
|
return {show: !prevState.show};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ export default class PushSettings extends AdminSettings {
|
|||||||
agree = true;
|
agree = true;
|
||||||
} else if (config.EmailSettings.PushNotificationServer === Constants.MTPNS) {
|
} else if (config.EmailSettings.PushNotificationServer === Constants.MTPNS) {
|
||||||
pushNotificationServerType = PUSH_NOTIFICATIONS_MTPNS;
|
pushNotificationServerType = PUSH_NOTIFICATIONS_MTPNS;
|
||||||
} else {
|
|
||||||
pushNotificationServerType = PUSH_NOTIFICATIONS_CUSTOM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let pushNotificationServer = config.EmailSettings.PushNotificationServer;
|
let pushNotificationServer = config.EmailSettings.PushNotificationServer;
|
||||||
|
|||||||
@@ -55,10 +55,11 @@ export default class PostAttachment extends React.PureComponent {
|
|||||||
|
|
||||||
toggleCollapseState(e) {
|
toggleCollapseState(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
this.setState((prevState) => {
|
||||||
this.setState({
|
return {
|
||||||
text: this.state.collapsed ? this.state.uncollapsedText : this.state.collapsedText,
|
text: prevState.collapsed ? prevState.uncollapsedText : prevState.collapsedText,
|
||||||
collapsed: !this.state.collapsed
|
collapsed: !prevState.collapsed
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ export default class PostBodyAdditionalContent extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleEmbedVisibility() {
|
toggleEmbedVisibility() {
|
||||||
this.setState({embedVisible: !this.state.embedVisible});
|
this.setState((prevState) => {
|
||||||
|
return {embedVisible: !prevState.embedVisible};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSlackAttachment() {
|
getSlackAttachment() {
|
||||||
|
|||||||
@@ -309,14 +309,13 @@ export default class Sidebar extends React.Component {
|
|||||||
curIndex = i;
|
curIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let nextChannel = allChannels[curIndex];
|
|
||||||
let nextIndex = curIndex;
|
let nextIndex = curIndex;
|
||||||
if (e.keyCode === Constants.KeyCodes.DOWN) {
|
if (e.keyCode === Constants.KeyCodes.DOWN) {
|
||||||
nextIndex = curIndex + 1;
|
nextIndex = curIndex + 1;
|
||||||
} else if (e.keyCode === Constants.KeyCodes.UP) {
|
} else if (e.keyCode === Constants.KeyCodes.UP) {
|
||||||
nextIndex = curIndex - 1;
|
nextIndex = curIndex - 1;
|
||||||
}
|
}
|
||||||
nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
const nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
||||||
ChannelActions.goToChannel(nextChannel);
|
ChannelActions.goToChannel(nextChannel);
|
||||||
this.updateScrollbarOnChannelChange(nextChannel);
|
this.updateScrollbarOnChannelChange(nextChannel);
|
||||||
this.isSwitchingChannel = false;
|
this.isSwitchingChannel = false;
|
||||||
@@ -342,7 +341,6 @@ export default class Sidebar extends React.Component {
|
|||||||
curIndex = i;
|
curIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let nextChannel = allChannels[curIndex];
|
|
||||||
let nextIndex = curIndex;
|
let nextIndex = curIndex;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let increment = 0;
|
let increment = 0;
|
||||||
@@ -359,7 +357,7 @@ export default class Sidebar extends React.Component {
|
|||||||
unreadCounts = ChannelStore.getUnreadCount(allChannels[nextIndex].id);
|
unreadCounts = ChannelStore.getUnreadCount(allChannels[nextIndex].id);
|
||||||
}
|
}
|
||||||
if (unreadCounts.msgs !== 0 || unreadCounts.mentions !== 0) {
|
if (unreadCounts.msgs !== 0 || unreadCounts.mentions !== 0) {
|
||||||
nextChannel = allChannels[nextIndex];
|
const nextChannel = allChannels[nextIndex];
|
||||||
ChannelActions.goToChannel(nextChannel);
|
ChannelActions.goToChannel(nextChannel);
|
||||||
this.updateScrollbarOnChannelChange(nextChannel);
|
this.updateScrollbarOnChannelChange(nextChannel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,9 @@ export default class Textbox extends React.Component {
|
|||||||
showPreview(e) {
|
showPreview(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
this.setState({preview: !this.state.preview});
|
this.setState((prevState) => {
|
||||||
|
return {preview: prevState.preview};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hidePreview() {
|
hidePreview() {
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ export default class SidebarRight extends React.Component {
|
|||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
this.setState({expanded: !this.state.expanded});
|
this.setState((prevState) => {
|
||||||
|
return {expanded: !prevState.expanded};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onInitializeVideoCall(userId, isCaller) {
|
onInitializeVideoCall(userId, isCaller) {
|
||||||
|
|||||||
@@ -656,14 +656,14 @@ export function applyTheme(theme) {
|
|||||||
changeCss('@media(min-width: 768px){.app__body .post:hover, .app__body .more-modal__list .more-modal__row:hover, .app__body .modal .settings-modal .settings-table .settings-content .section-min:hover', 'background:' + changeOpacity(theme.centerChannelColor, 0.08));
|
changeCss('@media(min-width: 768px){.app__body .post:hover, .app__body .more-modal__list .more-modal__row:hover, .app__body .modal .settings-modal .settings-table .settings-content .section-min:hover', 'background:' + changeOpacity(theme.centerChannelColor, 0.08));
|
||||||
changeCss('.app__body .more-modal__row.more-modal__row--selected, .app__body .date-separator.hovered--before:after, .app__body .date-separator.hovered--after:before, .app__body .new-separator.hovered--after:before, .app__body .new-separator.hovered--before:after', 'background:' + changeOpacity(theme.centerChannelColor, 0.07));
|
changeCss('.app__body .more-modal__row.more-modal__row--selected, .app__body .date-separator.hovered--before:after, .app__body .date-separator.hovered--after:before, .app__body .new-separator.hovered--after:before, .app__body .new-separator.hovered--before:after', 'background:' + changeOpacity(theme.centerChannelColor, 0.07));
|
||||||
changeCss('@media(min-width: 768px){.app__body .suggestion-list__content .command:hover, .app__body .mentions__name:hover, .app__body .dropdown-menu>li>a:focus, .app__body .dropdown-menu>li>a:hover', 'background:' + changeOpacity(theme.centerChannelColor, 0.15));
|
changeCss('@media(min-width: 768px){.app__body .suggestion-list__content .command:hover, .app__body .mentions__name:hover, .app__body .dropdown-menu>li>a:focus, .app__body .dropdown-menu>li>a:hover', 'background:' + changeOpacity(theme.centerChannelColor, 0.15));
|
||||||
changeCss('.app__body .suggestion--selected, .app__body .emoticon-suggestion:hover, .app__body .bot-indicator', 'background:' + changeOpacity(theme.centerChannelColor, 0.15), 1);
|
changeCss('.app__body .suggestion--selected, .app__body .emoticon-suggestion:hover, .app__body .bot-indicator', 'background:' + changeOpacity(theme.centerChannelColor, 0.15));
|
||||||
changeCss('code, .app__body .form-control[disabled], .app__body .form-control[readonly], .app__body fieldset[disabled] .form-control', 'background:' + changeOpacity(theme.centerChannelColor, 0.1));
|
changeCss('code, .app__body .form-control[disabled], .app__body .form-control[readonly], .app__body fieldset[disabled] .form-control', 'background:' + changeOpacity(theme.centerChannelColor, 0.1));
|
||||||
changeCss('@media(min-width: 960px){.app__body .post.current--user:hover .post__body ', 'background: none;');
|
changeCss('@media(min-width: 960px){.app__body .post.current--user:hover .post__body ', 'background: none;');
|
||||||
changeCss('.app__body .sidebar--right', 'color:' + theme.centerChannelColor);
|
changeCss('.app__body .sidebar--right', 'color:' + theme.centerChannelColor);
|
||||||
changeCss('.app__body .search-help-popover .search-autocomplete__item:hover, .app__body .modal .settings-modal .settings-table .settings-content .appearance-section .theme-elements__body', 'background:' + changeOpacity(theme.centerChannelColor, 0.05));
|
changeCss('.app__body .search-help-popover .search-autocomplete__item:hover, .app__body .modal .settings-modal .settings-table .settings-content .appearance-section .theme-elements__body', 'background:' + changeOpacity(theme.centerChannelColor, 0.05));
|
||||||
changeCss('.app__body .search-help-popover .search-autocomplete__item.selected', 'background:' + changeOpacity(theme.centerChannelColor, 0.15));
|
changeCss('.app__body .search-help-popover .search-autocomplete__item.selected', 'background:' + changeOpacity(theme.centerChannelColor, 0.15));
|
||||||
if (!UserAgent.isFirefox() && !UserAgent.isInternetExplorer() && !UserAgent.isEdge()) {
|
if (!UserAgent.isFirefox() && !UserAgent.isInternetExplorer() && !UserAgent.isEdge()) {
|
||||||
changeCss('body.app__body ::-webkit-scrollbar-thumb', 'background:' + changeOpacity(theme.centerChannelColor, 0.4), 1);
|
changeCss('body.app__body ::-webkit-scrollbar-thumb', 'background:' + changeOpacity(theme.centerChannelColor, 0.4));
|
||||||
}
|
}
|
||||||
changeCss('body', 'scrollbar-arrow-color:' + theme.centerChannelColor);
|
changeCss('body', 'scrollbar-arrow-color:' + theme.centerChannelColor);
|
||||||
changeCss('.app__body .post-create__container .post-create-body .btn-file svg, .app__body .post.post--compact .post-image__column .post-image__details svg, .app__body .modal .about-modal .about-modal__logo svg, .app__body .post .post__img svg', 'fill:' + theme.centerChannelColor);
|
changeCss('.app__body .post-create__container .post-create-body .btn-file svg, .app__body .post.post--compact .post-image__column .post-image__details svg, .app__body .modal .about-modal .about-modal__logo svg, .app__body .post .post__img svg', 'fill:' + theme.centerChannelColor);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user