From 5a0f95a0d93a4d27776e01292ac0743a77ebf01d Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Tue, 3 Dec 2024 20:47:19 +0000 Subject: [PATCH] Re-notify User canister after attempting to join if already in channel (#6964) --- backend/canisters/local_user_index/CHANGELOG.md | 1 + .../local_user_index/impl/src/updates/join_channel.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/canisters/local_user_index/CHANGELOG.md b/backend/canisters/local_user_index/CHANGELOG.md index 99cc181e9d..8264ab88ec 100644 --- a/backend/canisters/local_user_index/CHANGELOG.md +++ b/backend/canisters/local_user_index/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add chat + command text to bot command claims ([#6929](https://github.com/open-chat-labs/open-chat/pull/6929)) - Enable job to check User canister cycles balances ([#6959](https://github.com/open-chat-labs/open-chat/pull/6959)) +- Re-notify User canister after attempting to join if already in channel ([#6964](https://github.com/open-chat-labs/open-chat/pull/6964)) ## [[2.0.1481](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1481-local_user_index)] - 2024-11-29 diff --git a/backend/canisters/local_user_index/impl/src/updates/join_channel.rs b/backend/canisters/local_user_index/impl/src/updates/join_channel.rs index 24add7fed5..6c0d98a993 100644 --- a/backend/canisters/local_user_index/impl/src/updates/join_channel.rs +++ b/backend/canisters/local_user_index/impl/src/updates/join_channel.rs @@ -28,7 +28,8 @@ async fn join_channel(args: Args) -> Response { }; match community_canister_c2c_client::c2c_join_channel(args.community_id.into(), &c2c_args).await { Ok(response) => match response { - community_canister::c2c_join_channel::Response::Success(s) => { + community_canister::c2c_join_channel::Response::Success(s) + | community_canister::c2c_join_channel::Response::AlreadyInChannel(s) => { if !is_bot { mutate_state(|state| state.notify_user_joined_channel(user_details.user_id, args.community_id, &s)); } @@ -40,7 +41,6 @@ async fn join_channel(args: Args) -> Response { } SuccessJoinedCommunity(s) } - community_canister::c2c_join_channel::Response::AlreadyInChannel(s) => AlreadyInChannel(s), community_canister::c2c_join_channel::Response::GateCheckFailed(msg) => GateCheckFailed(msg), community_canister::c2c_join_channel::Response::UserNotInCommunity => CommunityNotPublic, community_canister::c2c_join_channel::Response::ChannelNotFound => ChannelNotFound,