mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Merge pull request #4559 from matrix-org/t3chguy/leave_tag
clear tag panel selection if the community selected is left
This commit is contained in:
commit
f4b55f056f
@ -18,6 +18,7 @@ import EventEmitter from 'events';
|
||||
import { groupMemberFromApiObject, groupRoomFromApiObject } from '../groups';
|
||||
import FlairStore from './FlairStore';
|
||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
||||
import dis from '../dispatcher';
|
||||
|
||||
function parseMembersResponse(response) {
|
||||
return response.chunk.map((apiMember) => groupMemberFromApiObject(apiMember));
|
||||
@ -295,6 +296,11 @@ class GroupStore extends EventEmitter {
|
||||
}
|
||||
|
||||
leaveGroup(groupId) {
|
||||
// ensure the tag panel filter is cleared if the group was selected
|
||||
dis.dispatch({
|
||||
action: "deselect_tags",
|
||||
tag: groupId,
|
||||
});
|
||||
return MatrixClientPeg.get().leaveGroup(groupId)
|
||||
// The user should now not be able to access group settings
|
||||
.then(this._fetchResource.bind(this, this.STATE_KEY.Summary, groupId))
|
||||
|
@ -168,9 +168,16 @@ class TagOrderStore extends Store {
|
||||
}
|
||||
break;
|
||||
case 'deselect_tags':
|
||||
this._setState({
|
||||
selectedTags: [],
|
||||
});
|
||||
if (payload.tag) {
|
||||
// if a tag is passed, only deselect that tag
|
||||
this._setState({
|
||||
selectedTags: this._state.selectedTags.filter(tag => tag !== payload.tag),
|
||||
});
|
||||
} else {
|
||||
this._setState({
|
||||
selectedTags: [],
|
||||
});
|
||||
}
|
||||
Analytics.trackEvent('FilterStore', 'deselect_tags');
|
||||
break;
|
||||
case 'on_client_not_viable':
|
||||
|
Loading…
Reference in New Issue
Block a user