mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
settings_bots: Open bots streams tab from personal settings > bots.
UI in settings for bot owners to unsubscribe their bots from streams, Personal settings > Bots > Bot info card > hashtag icon. Fixes: #22460
This commit is contained in:
committed by
Tim Abbott
parent
d3b4b1cefd
commit
9416427dc2
@@ -20,6 +20,7 @@ import {page_params} from "./page_params";
|
|||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
import * as settings_config from "./settings_config";
|
import * as settings_config from "./settings_config";
|
||||||
import * as ui_report from "./ui_report";
|
import * as ui_report from "./ui_report";
|
||||||
|
import * as user_profile from "./user_profile";
|
||||||
|
|
||||||
const OUTGOING_WEBHOOK_BOT_TYPE = "3";
|
const OUTGOING_WEBHOOK_BOT_TYPE = "3";
|
||||||
const GENERIC_BOT_TYPE = "1";
|
const GENERIC_BOT_TYPE = "1";
|
||||||
@@ -582,6 +583,14 @@ export function set_up() {
|
|||||||
$(this).attr("href", generate_zuliprc_uri(bot_id));
|
$(this).attr("href", generate_zuliprc_uri(bot_id));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#active_bots_list").on("click", "button.open_bots_subscribed_streams", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
const bot_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10);
|
||||||
|
const bot = people.get_by_user_id(bot_id);
|
||||||
|
user_profile.show_user_profile(bot, "user-profile-streams-tab");
|
||||||
|
});
|
||||||
|
|
||||||
new ClipboardJS("#copy_zuliprc", {
|
new ClipboardJS("#copy_zuliprc", {
|
||||||
text(trigger) {
|
text(trigger) {
|
||||||
const $bot_info = $(trigger).closest(".bot-information-box").find(".bot_info");
|
const $bot_info = $(trigger).closest(".bot-information-box").find(".bot_info");
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ export function hide_user_profile() {
|
|||||||
overlays.close_modal("user-profile-modal");
|
overlays.close_modal("user-profile-modal");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function show_user_profile(user) {
|
export function show_user_profile(user, default_tab_key = "profile-tab") {
|
||||||
popovers.hide_all();
|
popovers.hide_all();
|
||||||
|
|
||||||
const dateFormat = new Intl.DateTimeFormat("default", {dateStyle: "long"});
|
const dateFormat = new Intl.DateTimeFormat("default", {dateStyle: "long"});
|
||||||
@@ -203,9 +203,16 @@ export function show_user_profile(user) {
|
|||||||
$("#user-profile-modal-holder").html(render_user_profile_modal(args));
|
$("#user-profile-modal-holder").html(render_user_profile_modal(args));
|
||||||
overlays.open_modal("user-profile-modal", {autoremove: true});
|
overlays.open_modal("user-profile-modal", {autoremove: true});
|
||||||
$(".tabcontent").hide();
|
$(".tabcontent").hide();
|
||||||
$("#profile-tab").show(); // Show general profile details by default.
|
|
||||||
|
let default_tab = 0;
|
||||||
|
// Only checking this tab key as currently we only open this tab directly
|
||||||
|
// other than profile-tab.
|
||||||
|
if (default_tab_key === "user-profile-streams-tab") {
|
||||||
|
default_tab = 1;
|
||||||
|
}
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
selected: 0,
|
selected: default_tab,
|
||||||
child_wants_focus: true,
|
child_wants_focus: true,
|
||||||
values: [
|
values: [
|
||||||
{label: $t({defaultMessage: "Profile"}), key: "profile-tab"},
|
{label: $t({defaultMessage: "Profile"}), key: "profile-tab"},
|
||||||
|
|||||||
@@ -737,6 +737,10 @@ input[type="checkbox"] {
|
|||||||
.copy-gold {
|
.copy-gold {
|
||||||
color: hsl(51, 90%, 50%);
|
color: hsl(51, 90%, 50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.purple {
|
||||||
|
color: hsl(278, 62%, 68%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bot-information-box {
|
.bot-information-box {
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
<button type="submit" class="btn deactivate_bot danger-red" title="{{t 'Deactivate bot' }}" data-user-id="{{user_id}}">
|
<button type="submit" class="btn deactivate_bot danger-red" title="{{t 'Deactivate bot' }}" data-user-id="{{user_id}}">
|
||||||
<i class="fa fa-user-times" aria-hidden="true"></i>
|
<i class="fa fa-user-times" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
|
<button type="submit" class="btn open_bots_subscribed_streams" title="{{t 'Subscribed streams' }}" data-user-id="{{user_id}}">
|
||||||
|
<i class="fa fa-hashtag purple" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user