fix community channel selection
This commit is contained in:
parent
f79f51527b
commit
54030dcba9
1 changed files with 4 additions and 6 deletions
|
@ -698,10 +698,10 @@ class SelectedChannelStore extends Store {
|
||||||
|
|
||||||
this.communityIdToSelectedChannel = new Map();
|
this.communityIdToSelectedChannel = new Map();
|
||||||
|
|
||||||
selectedCommunity.subscribe((community) => {
|
filteredChannelsStore.subscribe((channels) => {
|
||||||
let channel = this.communityIdToSelectedChannel.get(community.id);
|
let channel = this.communityIdToSelectedChannel.get(selectedCommunity.value.id);
|
||||||
if (!channel && filteredChannelsStore.value.length) {
|
if (!channel && channels.length) {
|
||||||
channel = filteredChannelsStore.value[0];
|
channel = channels[0];
|
||||||
}
|
}
|
||||||
this.value = channel || noneChannel;
|
this.value = channel || noneChannel;
|
||||||
this.updated();
|
this.updated();
|
||||||
|
@ -716,9 +716,7 @@ class SelectedChannelStore extends Store {
|
||||||
this.communityIdToSelectedChannel.set(parseInt(communityId), channel);
|
this.communityIdToSelectedChannel.set(parseInt(communityId), channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.value = this.communityIdToSelectedChannel.get(selectedCommunity.value.id) || noneChannel;
|
|
||||||
this.updateSavedMap();
|
this.updateSavedMap();
|
||||||
this.updated();
|
|
||||||
});
|
});
|
||||||
gateway.subscribe(GatewayEventType.CommunityDelete, ({ id }) => {
|
gateway.subscribe(GatewayEventType.CommunityDelete, ({ id }) => {
|
||||||
if (this.communityIdToSelectedChannel.delete(id) && this.value && this.value.id === id) {
|
if (this.communityIdToSelectedChannel.delete(id) && this.value && this.value.id === id) {
|
||||||
|
|
Loading…
Reference in a new issue