diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index 4234cd0abf..048d94682d 100644 --- a/backend/canisters/user_index/CHANGELOG.md +++ b/backend/canisters/user_index/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Pass in `BotApiCanister` when installing a new LocalUserIndex ([#6828](https://github.com/open-chat-labs/open-chat/pull/6828)) - Simplify `inspect_message` ([#6847](https://github.com/open-chat-labs/open-chat/pull/6847)) - Allow bots to set a display name when registering ([#6850](https://github.com/open-chat-labs/open-chat/pull/6850)) +- Remove diamond only access to set display name ([#6879](https://github.com/open-chat-labs/open-chat/pull/6879)) ## [[2.0.1450](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1450-user_index)] - 2024-11-14 diff --git a/backend/canisters/user_index/api/src/updates/set_display_name.rs b/backend/canisters/user_index/api/src/updates/set_display_name.rs index 2d939f9b7a..bf759a7ce3 100644 --- a/backend/canisters/user_index/api/src/updates/set_display_name.rs +++ b/backend/canisters/user_index/api/src/updates/set_display_name.rs @@ -12,7 +12,6 @@ pub struct Args { #[derive(CandidType, Serialize, Deserialize, Debug)] pub enum Response { Success, - Unauthorized, UserNotFound, DisplayNameInvalid, DisplayNameTooShort(u16), diff --git a/backend/canisters/user_index/impl/src/updates/set_display_name.rs b/backend/canisters/user_index/impl/src/updates/set_display_name.rs index c19e693456..49cb02e555 100644 --- a/backend/canisters/user_index/impl/src/updates/set_display_name.rs +++ b/backend/canisters/user_index/impl/src/updates/set_display_name.rs @@ -26,10 +26,6 @@ fn set_display_name_impl(args: Args, state: &mut RuntimeState) -> Response { } let now = state.env.now(); - if !user.diamond_membership_details.is_active(now) && user.display_name.is_none() { - return Unauthorized; - } - let mut user_to_update = user.clone(); user_to_update.display_name.clone_from(&args.display_name); let user_id = user.user_id; diff --git a/backend/integration_tests/src/update_profile_tests.rs b/backend/integration_tests/src/update_profile_tests.rs index 1b9a5a9869..c07801a457 100644 --- a/backend/integration_tests/src/update_profile_tests.rs +++ b/backend/integration_tests/src/update_profile_tests.rs @@ -63,29 +63,3 @@ fn update_display_name_succeeds() { let updates = client::user::happy_path::updates(env, &user, now - 1); assert_eq!(updates.unwrap().display_name, OptionUpdate::SetToSome(display_name)); } - -#[test] -fn update_display_name_unauthorized_if_not_diamond_member() { - let mut wrapper = ENV.deref().get(); - let TestEnv { env, canister_ids, .. } = wrapper.env(); - - let user = client::register_user(env, canister_ids); - - env.advance_time(Duration::from_secs(10)); - - let display_name = random_string(); - - let response = client::user_index::set_display_name( - env, - user.principal, - canister_ids.user_index, - &user_index_canister::set_display_name::Args { - display_name: Some(display_name.clone()), - }, - ); - - assert!(matches!( - response, - user_index_canister::set_display_name::Response::Unauthorized - )); -} diff --git a/frontend/app/src/components/DisplayNameInput.svelte b/frontend/app/src/components/DisplayNameInput.svelte index d2716d4863..3ac4491d50 100644 --- a/frontend/app/src/components/DisplayNameInput.svelte +++ b/frontend/app/src/components/DisplayNameInput.svelte @@ -1,16 +1,12 @@ -{#if $isDiamond || originalDisplayName !== undefined} - - - -{:else} -
- -
-{/if} - - + + + diff --git a/frontend/app/src/components/home/upgrade/Features.svelte b/frontend/app/src/components/home/upgrade/Features.svelte index 9e78e2f82e..6bee118b1b 100644 --- a/frontend/app/src/components/home/upgrade/Features.svelte +++ b/frontend/app/src/components/home/upgrade/Features.svelte @@ -208,16 +208,6 @@ - -
-
- -
-
- -
-
-
diff --git a/tsBindings/userIndex/setDisplayName/UserIndexSetDisplayNameResponse.ts b/tsBindings/userIndex/setDisplayName/UserIndexSetDisplayNameResponse.ts index c8dd433ad2..f206989c44 100644 --- a/tsBindings/userIndex/setDisplayName/UserIndexSetDisplayNameResponse.ts +++ b/tsBindings/userIndex/setDisplayName/UserIndexSetDisplayNameResponse.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type UserIndexSetDisplayNameResponse = "Success" | "Unauthorized" | "UserNotFound" | "DisplayNameInvalid" | { "DisplayNameTooShort": number } | { "DisplayNameTooLong": number }; +export type UserIndexSetDisplayNameResponse = "Success" | "UserNotFound" | "DisplayNameInvalid" | { "DisplayNameTooShort": number } | { "DisplayNameTooLong": number };