mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
FIX: instantly removes group message when leaving (#25961)
Prior to this fix clicking <kbd>x</kdb> on a channel row would effectively leave the channel on server side, but it wouldn't disappear from the screen before a page refresh.
This commit is contained in:
@ -322,8 +322,14 @@ export default class ChatApi extends Service {
|
||||
* @param {number} channelId - The ID of the channel.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
leaveChannel(channelId) {
|
||||
return this.#deleteRequest(`/channels/${channelId}/memberships/me`);
|
||||
async leaveChannel(channelId) {
|
||||
await this.#deleteRequest(`/channels/${channelId}/memberships/me`);
|
||||
const channel = await this.chatChannelsManager.find(channelId, {
|
||||
fetchIfNotFound: false,
|
||||
});
|
||||
if (channel) {
|
||||
this.chatChannelsManager.remove(channel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user