only show selected custom tags in room list

This commit is contained in:
Bruno Windels 2019-02-05 17:38:36 +00:00
parent 579309c2e3
commit 414fffba3f

View file

@ -32,11 +32,12 @@ import DMRoomMap from '../../../utils/DMRoomMap';
const Receipt = require('../../../utils/Receipt');
import TagOrderStore from '../../../stores/TagOrderStore';
import RoomListStore from '../../../stores/RoomListStore';
import CustomRoomTagStore from '../../../stores/CustomRoomTagStore';
import GroupStore from '../../../stores/GroupStore';
import RoomSubList from '../../structures/RoomSubList';
import ResizeHandle from '../elements/ResizeHandle';
import {Resizer} from '../../../resizer'
import {Resizer} from '../../../resizer';
import {Layout, Distributor} from '../../../resizer/distributors/roomsublist2';
const HIDE_CONFERENCE_CHANS = true;
const STANDARD_TAGS_REGEX = /^(m\.(favourite|lowpriority|server_notice)|im\.vector\.fake\.(invite|recent|direct|archived))$/;
@ -121,6 +122,7 @@ module.exports = React.createClass({
incomingCall: null,
selectedTags: [],
hover: false,
customTags: CustomRoomTagStore.getTags(),
};
},
@ -170,6 +172,12 @@ module.exports = React.createClass({
this._delayedRefreshRoomList();
});
this._customTagStoreToken = CustomRoomTagStore.addListener(() => {
this.setState({
customTags: CustomRoomTagStore.getTags(),
});
});
this.refreshRoomList();
// order of the sublists
@ -271,6 +279,9 @@ module.exports = React.createClass({
if (this._groupStoreToken) {
this._groupStoreToken.unregister();
}
if (this._customTagStoreToken) {
this._customTagStoreToken.unregister();
}
// cancel any pending calls to the rate_limited_funcs
this._delayedRefreshRoomList.cancelPendingCall();
@ -717,7 +728,7 @@ module.exports = React.createClass({
];
const tagSubLists = Object.keys(this.state.lists)
.filter((tagName) => {
return !tagName.match(STANDARD_TAGS_REGEX);
return this.state.customTags[tagName] && !tagName.match(STANDARD_TAGS_REGEX);
}).map((tagName) => {
return {
list: this.state.lists[tagName],