From 414fffba3ffbb2fbecad56617c8204d16df6db83 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 5 Feb 2019 17:38:36 +0000 Subject: [PATCH] only show selected custom tags in room list --- src/components/views/rooms/RoomList.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index bbfc4649d2..b5dfa892fb 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -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],