Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_bots: Display unsubscribe button on bots full profile modal.
yogesh sirsatd3b4b1cefda9
diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.jsindex 67b51079f71..84052313842 100644--- a/frontend_tests/node_tests/people.js+++ b/frontend_tests/node_tests/people.js@@ -316,6 +316,9 @@ test_people("basics", () => {assert.equal(people.get_bot_owner_user(bot_botson).full_name, "Isaac Newton");+ assert.equal(people.can_admin_user(me), true);+ assert.equal(people.can_admin_user(bot_botson), false);+// Add our cross-realm bot. It won't add to our human// count, and it has no owner.people.add_cross_realm_user(welcome_bot);diff --git a/static/js/people.js b/static/js/people.jsindex 43b21e173b6..40377670049 100644--- a/static/js/people.js+++ b/static/js/people.js@@ -113,6 +113,13 @@ export function get_bot_owner_user(user) {return get_by_user_id(owner_id);}+export function can_admin_user(user) {+ return (+ (user.is_bot && user.bot_owner_id && user.bot_owner_id === page_params.user_id) ||+ is_my_user_id(user.user_id)+ );+}+export function id_matches_email_operand(user_id, email) {const person = get_by_email(email);diff --git a/static/js/user_profile.js b/static/js/user_profile.jsindex 990b894450d..d5e53fd71bf 100644--- a/static/js/user_profile.js+++ b/static/js/user_profile.js@@ -55,7 +55,7 @@ function initialize_bot_owner(element_id, bot_id) {function format_user_stream_list_item(stream, user) {const show_unsubscribe_button =- people.is_my_user_id(user.user_id) || settings_data.user_can_unsubscribe_other_users();+ people.can_admin_user(user) || settings_data.user_can_unsubscribe_other_users();const show_private_stream_unsub_tooltip =people.is_my_user_id(user.user_id) && stream.invite_only;return render_user_stream_list_item({@@ -252,7 +252,6 @@ function handle_remove_stream_subscription(target_user_id, sub, success, failureerror: failure,});} else {- // Unsubscribed by admin.subscriber_api.remove_user_id_from_stream(target_user_id, sub, success, failure);}}