From 55001f319327d16acbbed92ecdd1da023bd3c52b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 25 Aug 2020 21:52:48 -0600 Subject: [PATCH] Select the general chat for a community when viewing it --- src/stores/TagOrderStore.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/stores/TagOrderStore.js b/src/stores/TagOrderStore.js index 2b72a963b0..f02fce0769 100644 --- a/src/stores/TagOrderStore.js +++ b/src/stores/TagOrderStore.js @@ -166,6 +166,25 @@ class TagOrderStore extends Store { selectedTags: newTags, }); + if (!allowMultiple && newTags.length === 1) { + // We're in prototype behaviour: select the general chat for the community + const rooms = GroupStore.getGroupRooms(newTags[0]) + .map(r => MatrixClientPeg.get().getRoom(r.roomId)) + .filter(r => !!r); + let chat = rooms.find(r => { + const idState = r.currentState.getStateEvents("im.vector.general_chat", ""); + if (!idState || idState.getContent()['groupId'] !== newTags[0]) return false; + return true; + }); + if (!chat) chat = rooms[0]; + if (chat) { + dis.dispatch({ + action: 'view_room', + room_id: chat.roomId, + }); + } + } + Analytics.trackEvent('FilterStore', 'select_tag'); } break;