mirror of https://github.com/vector-im/riot-web
Merge pull request #4314 from matrix-org/travis/react-warnings/2-code-quality
Fix a number of minor code quality issuespull/21833/head
commit
0fcbe40bec
|
@ -79,7 +79,7 @@ export default createReactClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeviceVerificationChanged: function(userId, device) {
|
onDeviceVerificationChanged: function(userId, device) {
|
||||||
if (userId == this.props.event.getSender()) {
|
if (userId === this.props.event.getSender()) {
|
||||||
this.refreshDevice().then((dev) => {
|
this.refreshDevice().then((dev) => {
|
||||||
this.setState({ device: dev });
|
this.setState({ device: dev });
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@ import EventIndexPeg from "../../../../indexing/EventIndexPeg";
|
||||||
export default class ManageEventIndexDialog extends React.Component {
|
export default class ManageEventIndexDialog extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onFinished: PropTypes.func.isRequired,
|
onFinished: PropTypes.func.isRequired,
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -126,16 +126,12 @@ export default class ManageEventIndexDialog extends React.Component {
|
||||||
import("./DisableEventIndexDialog"),
|
import("./DisableEventIndexDialog"),
|
||||||
null, null, /* priority = */ false, /* static = */ true,
|
null, null, /* priority = */ false, /* static = */ true,
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
_onDone = () => {
|
|
||||||
this.props.onFinished(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
_onCrawlerSleepTimeChange = (e) => {
|
_onCrawlerSleepTimeChange = (e) => {
|
||||||
this.setState({crawlerSleepTime: e.target.value});
|
this.setState({crawlerSleepTime: e.target.value});
|
||||||
SettingsStore.setValue("crawlerSleepTime", null, SettingLevel.DEVICE, e.target.value);
|
SettingsStore.setValue("crawlerSleepTime", null, SettingLevel.DEVICE, e.target.value);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let crawlerState;
|
let crawlerState;
|
||||||
|
|
|
@ -433,7 +433,6 @@ export default createReactClass({
|
||||||
this._matrixClient = MatrixClientPeg.get();
|
this._matrixClient = MatrixClientPeg.get();
|
||||||
this._matrixClient.on("Group.myMembership", this._onGroupMyMembership);
|
this._matrixClient.on("Group.myMembership", this._onGroupMyMembership);
|
||||||
|
|
||||||
this._changeAvatarComponent = null;
|
|
||||||
this._initGroupStore(this.props.groupId, true);
|
this._initGroupStore(this.props.groupId, true);
|
||||||
|
|
||||||
this._dispatcherRef = dis.register(this._onAction);
|
this._dispatcherRef = dis.register(this._onAction);
|
||||||
|
|
|
@ -54,7 +54,7 @@ export default class SoftLogout extends React.Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
loginView: LOGIN_VIEW.LOADING,
|
loginView: LOGIN_VIEW.LOADING,
|
||||||
keyBackupNeeded: true, // assume we do while we figure it out (see componentWillMount)
|
keyBackupNeeded: true, // assume we do while we figure it out (see componentDidMount)
|
||||||
|
|
||||||
busy: false,
|
busy: false,
|
||||||
password: "",
|
password: "",
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default class RoomSettingsDialog extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
dis.unregister(this._dispatcherRef);
|
if (this._dispatcherRef) dis.unregister(this._dispatcherRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onAction = (payload) => {
|
_onAction = (payload) => {
|
||||||
|
|
|
@ -178,7 +178,7 @@ export default class AppTile extends React.Component {
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
// Widget action listeners
|
// Widget action listeners
|
||||||
dis.unregister(this.dispatcherRef);
|
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
||||||
|
|
||||||
// if it's not remaining on screen, get rid of the PersistedElement container
|
// if it's not remaining on screen, get rid of the PersistedElement container
|
||||||
if (!ActiveWidgetStore.getWidgetPersistence(this.props.app.id)) {
|
if (!ActiveWidgetStore.getWidgetPersistence(this.props.app.id)) {
|
||||||
|
|
|
@ -24,8 +24,8 @@ import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
|
|
||||||
function languageMatchesSearchQuery(query, language) {
|
function languageMatchesSearchQuery(query, language) {
|
||||||
if (language.label.toUpperCase().indexOf(query.toUpperCase()) == 0) return true;
|
if (language.label.toUpperCase().includes(query.toUpperCase())) return true;
|
||||||
if (language.value.toUpperCase() == query.toUpperCase()) return true;
|
if (language.value.toUpperCase() === query.toUpperCase()) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ const Pill = createReactClass({
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._unmounted = false;
|
this._unmounted = false;
|
||||||
this._matrixClient = MatrixClientPeg.get();
|
this._matrixClient = MatrixClientPeg.get();
|
||||||
this.componentWillReceiveProps(this.props);
|
this.componentWillReceiveProps(this.props); // HACK: We shouldn't be calling lifecycle functions ourselves.
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
|
@ -68,7 +68,7 @@ export default createReactClass({
|
||||||
MatrixClientPeg.get().removeListener('RoomState.events', this.onRoomStateEvents);
|
MatrixClientPeg.get().removeListener('RoomState.events', this.onRoomStateEvents);
|
||||||
}
|
}
|
||||||
WidgetEchoStore.removeListener('update', this._updateApps);
|
WidgetEchoStore.removeListener('update', this._updateApps);
|
||||||
dis.unregister(this.dispatcherRef);
|
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
componentWillReceiveProps(newProps) {
|
||||||
|
|
|
@ -61,7 +61,6 @@ export default class RoomRecoveryReminder extends React.PureComponent {
|
||||||
loading: false,
|
loading: false,
|
||||||
error: e,
|
error: e,
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ describe.skip('RoomSettings', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// XXX: Can't test this because we `getRoomDirectoryVisibility` in `componentWillMount`
|
// XXX: Can't test this because we `getRoomDirectoryVisibility` in `componentDidMount`
|
||||||
xit('should set room directory publicity when set to true', (done) => {
|
xit('should set room directory publicity when set to true', (done) => {
|
||||||
const isRoomPublished = true;
|
const isRoomPublished = true;
|
||||||
roomSettings.setState({
|
roomSettings.setState({
|
||||||
|
|
Loading…
Reference in New Issue