mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
streams: Refactor setup_subscriptions_stream_hash arguments.
This refactors the arguments in the `setup_subscriptions_stream_hash` method to remove the `stream_id` param and just take it from the `sub` argument it is passed (which is an object that contains the property, `stream_id`.
This commit is contained in:
committed by
Tim Abbott
parent
7b8f2f8828
commit
9e9927d1d0
@@ -2,11 +2,11 @@ var stream_edit = (function () {
|
|||||||
|
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
function setup_subscriptions_stream_hash(sub, stream_id) {
|
function setup_subscriptions_stream_hash(sub) {
|
||||||
|
var id = sub.stream_id;
|
||||||
subs.change_state.prevent_once();
|
subs.change_state.prevent_once();
|
||||||
window.location.hash = "#streams" + "/" +
|
|
||||||
stream_id + "/" +
|
window.location.hash = "#streams" + "/" + id + "/" + hash_util.encodeHashComponent(sub.name);
|
||||||
hash_util.encodeHashComponent(sub.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function settings_for_sub(sub) {
|
function settings_for_sub(sub) {
|
||||||
@@ -568,7 +568,6 @@ $(function () {
|
|||||||
$("#subscriptions_table").on("click", ".sub_unsub_button", function (e) {
|
$("#subscriptions_table").on("click", ".sub_unsub_button", function (e) {
|
||||||
var sub = get_sub_for_target(e.target);
|
var sub = get_sub_for_target(e.target);
|
||||||
var stream_row = $(this).parent();
|
var stream_row = $(this).parent();
|
||||||
var stream_id = stream_row.attr("data-stream-id");
|
|
||||||
subs.sub_or_unsub(sub);
|
subs.sub_or_unsub(sub);
|
||||||
var sub_settings = settings_for_sub(sub);
|
var sub_settings = settings_for_sub(sub);
|
||||||
var regular_sub_settings = sub_settings.find(".regular_subscription_settings");
|
var regular_sub_settings = sub_settings.find(".regular_subscription_settings");
|
||||||
@@ -579,7 +578,7 @@ $(function () {
|
|||||||
regular_sub_settings.removeClass("in");
|
regular_sub_settings.removeClass("in");
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_subscriptions_stream_hash(sub, stream_id);
|
setup_subscriptions_stream_hash(sub);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
@@ -589,7 +588,7 @@ $(function () {
|
|||||||
exports.show_stream_row(this, true);
|
exports.show_stream_row(this, true);
|
||||||
var stream_id = $(this).attr("data-stream-id");
|
var stream_id = $(this).attr("data-stream-id");
|
||||||
var sub = stream_data.get_sub_by_id(stream_id);
|
var sub = stream_data.get_sub_by_id(stream_id);
|
||||||
setup_subscriptions_stream_hash(sub, stream_id);
|
setup_subscriptions_stream_hash(sub);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user