Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_profile: Refactor stream list container item template.

Pratik Chanda9958fcc93279
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index d28ea47e90b..f216fc4377f 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -11,11 +11,11 @@ import render_admin_human_form from "../templates/settings/admin_human_form.hbs"
import render_edit_bot_form from "../templates/settings/edit_bot_form.hbs";
import render_settings_edit_embedded_bot_service from "../templates/settings/edit_embedded_bot_service.hbs";
import render_settings_edit_outgoing_webhook_service from "../templates/settings/edit_outgoing_webhook_service.hbs";
+import render_stream_list_item from "../templates/stream_list_item.hbs";
import render_user_custom_profile_fields from "../templates/user_custom_profile_fields.hbs";
import render_user_full_name from "../templates/user_full_name.hbs";
import render_user_group_list_item from "../templates/user_group_list_item.hbs";
import render_user_profile_modal from "../templates/user_profile_modal.hbs";
-import render_user_stream_list_item from "../templates/user_stream_list_item.hbs";
import * as avatar from "./avatar.ts";
import * as bot_data from "./bot_data.ts";
@@ -284,7 +284,7 @@ function format_user_stream_list_item_html(stream: StreamSubscription, user: Use
people.is_my_user_id(user.user_id) && stream.invite_only;
const show_last_user_in_private_stream_unsub_tooltip =
stream.invite_only && peer_data.get_subscriber_count(stream.stream_id) === 1;
- return render_user_stream_list_item({
+ return render_stream_list_item({
name: stream.name,
stream_id: stream.stream_id,
stream_color: stream.color,
@@ -1318,10 +1318,10 @@ export function initialize(): void {
);
});
- $("body").on("click", "#user-profile-modal .remove-subscription-button", (e) => {
+ $("body").on("click", "#user-profile-modal .stream-row .remove-button", (e) => {
e.preventDefault();
e.stopPropagation();
- const $remove_button = $(e.currentTarget).closest(".remove-subscription-button");
+ const $remove_button = $(e.currentTarget).closest(".remove-button");
buttons.show_button_loading_indicator($remove_button);
const $stream_row = $(e.currentTarget).closest("[data-stream-id]");
const stream_id = Number.parseInt($stream_row.attr("data-stream-id")!, 10);
diff --git a/web/styles/modal.css b/web/styles/modal.css
index c9bd2ab45fb..912f1df1614 100644
--- a/web/styles/modal.css
+++ b/web/styles/modal.css
@@ -208,18 +208,19 @@
-webkit-overflow-scrolling: touch;
.user-profile-group-row,
- .user-profile-channel-row {
+ .stream-row {
display: flex;
justify-content: space-between;
padding: 0.3125em 0.625em;
align-items: center;
text-decoration: none;
+ border-bottom: none;
border-radius: 4px;
color: var(--color-dropdown-item);
cursor: pointer;
.user-group-list-item,
- .user-stream-list-item {
+ .stream-row-content {
display: flex;
overflow: hidden;
}
@@ -243,7 +244,7 @@
}
.user-group-name,
- .user-stream-name {
+ .stream-name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
diff --git a/web/templates/stream_list_item.hbs b/web/templates/stream_list_item.hbs
new file mode 100644
index 00000000000..b25f67a5970
--- /dev/null
+++ b/web/templates/stream_list_item.hbs
@@ -0,0 +1,21 @@
+<li class="stream-list-item" role="presentation" data-stream-id="{{stream_id}}">
+ <a class="stream-row hidden-remove-button-row" href="{{stream_edit_url}}">
+ <span class="stream-row-content">
+ <span class="stream-privacy-original-color-{{stream_id}} stream-privacy filter-icon" style="color: {{stream_color}}">
+ {{> stream_privacy . }}
+ </span>
+ <span class="stream-name">{{name}}</span>
+ </span>
+ <div class="remove-button-wrapper">
+ {{#if show_unsubscribe_button}}
+ {{#if show_private_stream_unsub_tooltip}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe from private channels.") }}
+ {{else if show_last_user_in_private_stream_unsub_tooltip}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe the last user from a private channel.") }}
+ {{else}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Unsubscribe") }}
+ {{/if}}
+ {{/if}}
+ </div>
+ </a>
+</li>
diff --git a/web/templates/user_stream_list_item.hbs b/web/templates/user_stream_list_item.hbs
deleted file mode 100644
index 75458f2fc40..00000000000
--- a/web/templates/user_stream_list_item.hbs
+++ /dev/null
@@ -1,21 +0,0 @@
-<li class="stream-list-item" role="presentation" data-stream-id="{{stream_id}}">
- <a class="user-profile-channel-row hidden-remove-button-row" href="{{stream_edit_url}}">
- <span class="user-stream-list-item">
- <span class="stream-privacy-original-color-{{stream_id}} stream-privacy filter-icon" style="color: {{stream_color}}">
- {{> stream_privacy . }}
- </span>
- <span class="user-stream-name">{{name}}</span>
- </span>
- <div class="remove-button-wrapper">
- {{#if show_unsubscribe_button}}
- {{#if show_private_stream_unsub_tooltip}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe from private channels.") }}
- {{else if show_last_user_in_private_stream_unsub_tooltip}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe the last user from a private channel.") }}
- {{else}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Unsubscribe") }}
- {{/if}}
- {{/if}}
- </div>
- </a>
-</li>