Fixed linter errors
Signed-off-by: Agusti Bau <agustibau@gmail.com>
This commit is contained in:
parent
cd87124e0f
commit
ff3272061c
1 changed files with 15 additions and 13 deletions
|
@ -25,13 +25,13 @@ import Analytics from "../../../../../Analytics";
|
||||||
import Modal from "../../../../../Modal";
|
import Modal from "../../../../../Modal";
|
||||||
import * as sdk from "../../../../..";
|
import * as sdk from "../../../../..";
|
||||||
import {sleep} from "../../../../../utils/promise";
|
import {sleep} from "../../../../../utils/promise";
|
||||||
import dis from "../../../../../dispatcher"
|
import dis from "../../../../../dispatcher";
|
||||||
|
|
||||||
export class IgnoredUser extends React.Component {
|
export class IgnoredUser extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
userId: PropTypes.string.isRequired,
|
userId: PropTypes.string.isRequired,
|
||||||
onUnignored: PropTypes.func.isRequired,
|
onUnignored: PropTypes.func.isRequired,
|
||||||
inProgress: PropTypes.bool.isRequired
|
inProgress: PropTypes.bool.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
_onUnignoreClicked = (e) => {
|
_onUnignoreClicked = (e) => {
|
||||||
|
@ -69,17 +69,16 @@ export default class SecurityUserSettingsTab extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_onAction({action}) {
|
_onAction({action}) {
|
||||||
if (action === "ignore_state_changed"){
|
if (action === "ignore_state_changed") {
|
||||||
const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers();
|
const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers();
|
||||||
const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e))
|
const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e));
|
||||||
this.setState({ignoredUserIds, waitingUnignored: newWaitingUnignored})
|
this.setState({ignoredUserIds, waitingUnignored: newWaitingUnignored});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.dispatcherRef = dis.register(this._onAction)
|
this.dispatcherRef = dis.register(this._onAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -109,17 +108,15 @@ export default class SecurityUserSettingsTab extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
_onUserUnignored = async (userId) => {
|
_onUserUnignored = async (userId) => {
|
||||||
|
const {ignoredUserIds, waitingUnignored} = this.state;
|
||||||
const {ignoredUserIds, waitingUnignored} = this.state
|
|
||||||
const currentlyIgnoredUserIds = ignoredUserIds.filter(e=> !waitingUnignored.includes(e));
|
const currentlyIgnoredUserIds = ignoredUserIds.filter(e=> !waitingUnignored.includes(e));
|
||||||
|
|
||||||
const index = currentlyIgnoredUserIds.indexOf(userId);
|
const index = currentlyIgnoredUserIds.indexOf(userId);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
currentlyIgnoredUserIds.splice(index, 1);
|
currentlyIgnoredUserIds.splice(index, 1);
|
||||||
this.setState(({waitingUnignored})=>({waitingUnignored:[...waitingUnignored, userId]}))
|
this.setState(({waitingUnignored})=>({waitingUnignored: [...waitingUnignored, userId]}));
|
||||||
MatrixClientPeg.get().setIgnoredUsers(currentlyIgnoredUserIds);
|
MatrixClientPeg.get().setIgnoredUsers(currentlyIgnoredUserIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_getInvitedRooms = () => {
|
_getInvitedRooms = () => {
|
||||||
|
@ -230,7 +227,12 @@ export default class SecurityUserSettingsTab extends React.Component {
|
||||||
if (!ignoredUserIds || ignoredUserIds.length === 0) return null;
|
if (!ignoredUserIds || ignoredUserIds.length === 0) return null;
|
||||||
|
|
||||||
const userIds = ignoredUserIds
|
const userIds = ignoredUserIds
|
||||||
.map((u) => <IgnoredUser userId={u} onUnignored={this._onUserUnignored} key={u} inProgress={waitingUnignored.includes(u)} />);
|
.map((u) => <IgnoredUser
|
||||||
|
userId={u}
|
||||||
|
onUnignored={this._onUserUnignored}
|
||||||
|
key={u}
|
||||||
|
inProgress={waitingUnignored.includes(u)}
|
||||||
|
/>);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mx_SettingsTab_section'>
|
<div className='mx_SettingsTab_section'>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue