Select the general chat for a community when viewing it
This commit is contained in:
parent
20c562c208
commit
55001f3193
1 changed files with 19 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue