only show selected custom tags in room list

pull/21833/head
Bruno Windels 2019-02-05 17:38:36 +00:00
parent 579309c2e3
commit 414fffba3f
1 changed files with 13 additions and 2 deletions

View File

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