minor: Make stream tab selector in profile modal more specific.

It is changed to avoid having an id that is too generic
and could invite unwanted bugs.
This commit is contained in:
m-e-l-u-h-a-n
2021-07-03 00:55:50 +05:30
committed by Tim Abbott
parent 5dfd11673a
commit a428e546b8
3 changed files with 11 additions and 11 deletions

View File

@@ -64,7 +64,7 @@ function render_user_stream_list(streams, user) {
return format_user_stream_list_item(item, user); return format_user_stream_list_item(item, user);
}, },
filter: { filter: {
element: $("#streams-tab .stream-search"), element: $("#user-profile-streams-tab .stream-search"),
predicate(item, value) { predicate(item, value) {
return item && item.name.toLocaleLowerCase().includes(value); return item && item.name.toLocaleLowerCase().includes(value);
}, },
@@ -171,7 +171,7 @@ export function show_user_profile(user) {
child_wants_focus: true, child_wants_focus: true,
values: [ values: [
{label: $t({defaultMessage: "Profile"}), key: "profile-tab"}, {label: $t({defaultMessage: "Profile"}), key: "profile-tab"},
{label: $t({defaultMessage: "Streams"}), key: "streams-tab"}, {label: $t({defaultMessage: "Streams"}), key: "user-profile-streams-tab"},
{label: $t({defaultMessage: "User groups"}), key: "groups-tab"}, {label: $t({defaultMessage: "User groups"}), key: "groups-tab"},
], ],
callback(name, key) { callback(name, key) {
@@ -181,7 +181,7 @@ export function show_user_profile(user) {
case "groups-tab": case "groups-tab":
render_user_group_list(groups_of_user, user); render_user_group_list(groups_of_user, user);
break; break;
case "streams-tab": case "user-profile-streams-tab":
render_user_stream_list(user_streams, user); render_user_stream_list(user_streams, user);
break; break;
} }
@@ -233,7 +233,7 @@ export function register_click_handlers() {
stream_row.closest("#user-profile-modal").attr("data-user-id"), stream_row.closest("#user-profile-modal").attr("data-user-id"),
10, 10,
); );
const alert_box = $("#streams-tab .stream_list_info"); const alert_box = $("#user-profile-streams-tab .stream_list_info");
function removal_success(data) { function removal_success(data) {
if (data.removed.length > 0) { if (data.removed.length > 0) {
@@ -285,7 +285,7 @@ export function register_click_handlers() {
}); });
$("body").on("click", "#user-profile-modal #clear_stream_search", (e) => { $("body").on("click", "#user-profile-modal #clear_stream_search", (e) => {
const input = $("#streams-tab .stream-search"); const input = $("#user-profile-streams-tab .stream-search");
input.val(""); input.val("");
// This is a hack to rerender complete // This is a hack to rerender complete
@@ -306,13 +306,13 @@ export function register_click_handlers() {
hide_user_profile(); hide_user_profile();
}); });
$("body").on("input", "#streams-tab .stream-search", () => { $("body").on("input", "#user-profile-streams-tab .stream-search", () => {
const input = $("#streams-tab .stream-search"); const input = $("#user-profile-streams-tab .stream-search");
if (input.val().trim().length > 0) { if (input.val().trim().length > 0) {
$("#streams-tab #clear_stream_search").show(); $("#user-profile-streams-tab #clear_stream_search").show();
input.css("margin-right", "-20px"); input.css("margin-right", "-20px");
} else { } else {
$("#streams-tab #clear_stream_search").hide(); $("#user-profile-streams-tab #clear_stream_search").hide();
input.css("margin-right", "0"); input.css("margin-right", "0");
} }
}); });

View File

@@ -363,7 +363,7 @@ ul {
margin-bottom: 20px; margin-bottom: 20px;
} }
#streams-tab { #user-profile-streams-tab {
.stream_list_info { .stream_list_info {
margin-bottom: 8px; margin-bottom: 8px;
} }

View File

@@ -64,7 +64,7 @@
</div> </div>
</div> </div>
<div class="tabcontent" id="streams-tab"> <div class="tabcontent" id="user-profile-streams-tab">
<div class="stream-list-top-section"> <div class="stream-list-top-section">
<div class="header-section"> <div class="header-section">
<h3 class="stream-list-header">{{t 'Subscribed streams' }}</h3> <h3 class="stream-list-header">{{t 'Subscribed streams' }}</h3>