Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix a number of minor code quality issues #4314

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default createReactClass({
},

onDeviceVerificationChanged: function(userId, device) {
if (userId == this.props.event.getSender()) {
if (userId === this.props.event.getSender()) {
this.refreshDevice().then((dev) => {
this.setState({ device: dev });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import EventIndexPeg from "../../../../indexing/EventIndexPeg";
export default class ManageEventIndexDialog extends React.Component {
static propTypes = {
onFinished: PropTypes.func.isRequired,
}
};

constructor(props) {
super(props);
Expand Down Expand Up @@ -126,16 +126,12 @@ export default class ManageEventIndexDialog extends React.Component {
import("./DisableEventIndexDialog"),
null, null, /* priority = */ false, /* static = */ true,
);
}

_onDone = () => {
this.props.onFinished(true);
}
};

_onCrawlerSleepTimeChange = (e) => {
this.setState({crawlerSleepTime: e.target.value});
SettingsStore.setValue("crawlerSleepTime", null, SettingLevel.DEVICE, e.target.value);
}
};

render() {
let crawlerState;
Expand Down
1 change: 0 additions & 1 deletion src/components/structures/GroupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ export default createReactClass({
this._matrixClient = MatrixClientPeg.get();
this._matrixClient.on("Group.myMembership", this._onGroupMyMembership);

this._changeAvatarComponent = null;
this._initGroupStore(this.props.groupId, true);

this._dispatcherRef = dis.register(this._onAction);
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/SoftLogout.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class SoftLogout extends React.Component {

this.state = {
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,
password: "",
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/RoomSettingsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class RoomSettingsDialog extends React.Component {
}

componentWillUnmount() {
dis.unregister(this._dispatcherRef);
if (this._dispatcherRef) dis.unregister(this._dispatcherRef);
}

_onAction = (payload) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/elements/AppTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class AppTile extends React.Component {

componentWillUnmount() {
// 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 (!ActiveWidgetStore.getWidgetPersistence(this.props.id)) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/elements/LanguageDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import SettingsStore from "../../../settings/SettingsStore";
import { _t } from "../../../languageHandler";

function languageMatchesSearchQuery(query, language) {
if (language.label.toUpperCase().indexOf(query.toUpperCase()) == 0) return true;
if (language.value.toUpperCase() == query.toUpperCase()) return true;
if (language.label.toUpperCase().includes(query.toUpperCase())) return true;
if (language.value.toUpperCase() === query.toUpperCase()) return true;
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/views/elements/Pill.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const Pill = createReactClass({
componentWillMount() {
this._unmounted = false;
this._matrixClient = MatrixClientPeg.get();
this.componentWillReceiveProps(this.props);
this.componentWillReceiveProps(this.props); // HACK: We shouldn't be calling lifecycle functions ourselves.
},

componentWillUnmount() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/rooms/AppsDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default createReactClass({
MatrixClientPeg.get().removeListener('RoomState.events', this.onRoomStateEvents);
}
WidgetEchoStore.removeListener('update', this._updateApps);
dis.unregister(this.dispatcherRef);
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
},

componentWillReceiveProps(newProps) {
Expand Down
1 change: 0 additions & 1 deletion src/components/views/rooms/RoomRecoveryReminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default class RoomRecoveryReminder extends React.PureComponent {
loading: false,
error: e,
});
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/components/views/rooms/RoomSettings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
const isRoomPublished = true;
roomSettings.setState({
Expand Down