mirror of https://github.com/zulip/zulip.git
js: Clean up stream_id type confusion.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
1a07f7b158
commit
45bee2f512
|
@ -258,7 +258,7 @@ exports.initialize = function () {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// Note that we may have an href here, but we trust the stream id more,
|
// Note that we may have an href here, but we trust the stream id more,
|
||||||
// so we re-encode the hash.
|
// so we re-encode the hash.
|
||||||
const stream_id = $(this).attr('data-stream-id');
|
const stream_id = parseInt($(this).attr('data-stream-id'), 10);
|
||||||
if (stream_id) {
|
if (stream_id) {
|
||||||
hashchange.go_to_location(hash_util.by_stream_uri(stream_id));
|
hashchange.go_to_location(hash_util.by_stream_uri(stream_id));
|
||||||
return;
|
return;
|
||||||
|
@ -392,7 +392,7 @@ exports.initialize = function () {
|
||||||
|
|
||||||
$('body').on('click', '.on_hover_topic_mute', function (e) {
|
$('body').on('click', '.on_hover_topic_mute', function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const stream_id = $(e.currentTarget).attr('data-stream-id');
|
const stream_id = parseInt($(e.currentTarget).attr('data-stream-id'), 10);
|
||||||
const topic = $(e.currentTarget).attr('data-topic-name');
|
const topic = $(e.currentTarget).attr('data-topic-name');
|
||||||
muting_ui.mute(stream_id, topic);
|
muting_ui.mute(stream_id, topic);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ exports.register_click_handlers = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.popover_mute_topic', function (e) {
|
$('body').on('click', '.popover_mute_topic', function (e) {
|
||||||
const stream_id = $(e.currentTarget).attr('data-msg-stream-id');
|
const stream_id = parseInt($(e.currentTarget).attr('data-msg-stream-id'), 10);
|
||||||
const topic = $(e.currentTarget).attr('data-msg-topic');
|
const topic = $(e.currentTarget).attr('data-msg-topic');
|
||||||
|
|
||||||
exports.hide_actions_popover();
|
exports.hide_actions_popover();
|
||||||
|
@ -1030,7 +1030,7 @@ exports.register_click_handlers = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.popover_unmute_topic', function (e) {
|
$('body').on('click', '.popover_unmute_topic', function (e) {
|
||||||
const stream_id = $(e.currentTarget).attr('data-msg-stream-id');
|
const stream_id = parseInt($(e.currentTarget).attr('data-msg-stream-id'), 10);
|
||||||
const topic = $(e.currentTarget).attr('data-msg-topic');
|
const topic = $(e.currentTarget).attr('data-msg-topic');
|
||||||
|
|
||||||
exports.hide_actions_popover();
|
exports.hide_actions_popover();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
exports.set_up = function () {
|
exports.set_up = function () {
|
||||||
$('body').on('click', '.settings-unmute-topic', function (e) {
|
$('body').on('click', '.settings-unmute-topic', function (e) {
|
||||||
const $row = $(this).closest("tr");
|
const $row = $(this).closest("tr");
|
||||||
const stream_id = $row.attr("data-stream-id");
|
const stream_id = parseInt($row.attr("data-stream-id"), 10);
|
||||||
const topic = $row.attr("data-topic");
|
const topic = $row.attr("data-topic");
|
||||||
|
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
|
@ -59,7 +59,7 @@ exports.set_colorpicker_color = function (colorpicker, color) {
|
||||||
exports.update_stream_color = function (sub, color, opts) {
|
exports.update_stream_color = function (sub, color, opts) {
|
||||||
opts = _.defaults({}, opts, {update_historical: false});
|
opts = _.defaults({}, opts, {update_historical: false});
|
||||||
sub.color = color;
|
sub.color = color;
|
||||||
const id = parseInt(sub.stream_id, 10);
|
const id = sub.stream_id;
|
||||||
// The swatch in the subscription row header.
|
// The swatch in the subscription row header.
|
||||||
$(".stream-row[data-stream-id='" + id + "'] .icon").css('background-color', color);
|
$(".stream-row[data-stream-id='" + id + "'] .icon").css('background-color', color);
|
||||||
// The swatch in the color picker.
|
// The swatch in the color picker.
|
||||||
|
|
|
@ -19,7 +19,7 @@ exports.setup_subscriptions_tab_hash = function (tab_key_value) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.settings_for_sub = function (sub) {
|
exports.settings_for_sub = function (sub) {
|
||||||
const id = parseInt(sub.stream_id, 10);
|
const id = sub.stream_id;
|
||||||
return $("#subscription_overlay .subscription_settings[data-stream-id='" + id + "']");
|
return $("#subscription_overlay .subscription_settings[data-stream-id='" + id + "']");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ exports.show_subs_pane = {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.check_button_for_sub = function (sub) {
|
exports.check_button_for_sub = function (sub) {
|
||||||
const id = parseInt(sub.stream_id, 10);
|
const id = sub.stream_id;
|
||||||
return $(".stream-row[data-stream-id='" + id + "'] .check");
|
return $(".stream-row[data-stream-id='" + id + "'] .check");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@ exports.row_for_stream_id = function (stream_id) {
|
||||||
exports.settings_button_for_sub = function (sub) {
|
exports.settings_button_for_sub = function (sub) {
|
||||||
// We don't do expectOne() here, because this button is only
|
// We don't do expectOne() here, because this button is only
|
||||||
// visible if the user has that stream selected in the streams UI.
|
// visible if the user has that stream selected in the streams UI.
|
||||||
const id = parseInt(sub.stream_id, 10);
|
const id = sub.stream_id;
|
||||||
return $(".subscription_settings[data-stream-id='" + id + "'] .subscribe-button");
|
return $(".subscription_settings[data-stream-id='" + id + "'] .subscribe-button");
|
||||||
};
|
};
|
||||||
|
|
||||||
function get_row_data(row) {
|
function get_row_data(row) {
|
||||||
const row_id = row.attr('data-stream-id');
|
const row_id = parseInt(row.attr('data-stream-id'), 10);
|
||||||
if (row_id) {
|
if (row_id) {
|
||||||
const row_object = stream_data.get_sub_by_id(row_id);
|
const row_object = stream_data.get_sub_by_id(row_id);
|
||||||
return {
|
return {
|
||||||
|
@ -43,7 +43,7 @@ function get_row_data(row) {
|
||||||
|
|
||||||
exports.get_active_data = function () {
|
exports.get_active_data = function () {
|
||||||
const active_row = $('div.stream-row.active');
|
const active_row = $('div.stream-row.active');
|
||||||
const valid_active_id = active_row.attr('data-stream-id');
|
const valid_active_id = parseInt(active_row.attr('data-stream-id'), 10);
|
||||||
const active_tab = $('.subscriptions-container').find('div.ind-tab.selected');
|
const active_tab = $('.subscriptions-container').find('div.ind-tab.selected');
|
||||||
return {
|
return {
|
||||||
row: active_row,
|
row: active_row,
|
||||||
|
|
Loading…
Reference in New Issue