mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
subs: Remove complicated onlaunch triggers.
We can reliably just use hashchange.go_to_location() when you click on "Stream Settings" in the left sidebar popover.
This commit is contained in:
@@ -209,12 +209,8 @@ exports.register_stream_handlers = function () {
|
||||
var sub = stream_popover_sub(e);
|
||||
exports.hide_stream_popover();
|
||||
|
||||
hashchange.go_to_location("#streams");
|
||||
// the template for subs needs to render.
|
||||
|
||||
subs.onlaunch("narrow_to_row", function () {
|
||||
$(".stream-row[data-stream-id='" + sub.stream_id + "']").click();
|
||||
}, false);
|
||||
var stream_edit_hash = hash_util.stream_edit_uri(sub);
|
||||
hashchange.go_to_location(stream_edit_hash);
|
||||
});
|
||||
|
||||
// Narrow to stream
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
var subs = (function () {
|
||||
|
||||
var meta = {
|
||||
callbacks: {},
|
||||
};
|
||||
var exports = {};
|
||||
|
||||
exports.show_subs_pane = {
|
||||
@@ -558,7 +555,6 @@ exports.setup_page = function (callback) {
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
exports.onlaunchtrigger();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,28 +565,6 @@ exports.setup_page = function (callback) {
|
||||
}
|
||||
};
|
||||
|
||||
// add a function to run on subscription page launch by name,
|
||||
// and specify whether it should be kept or just run once (boolean).
|
||||
exports.onlaunch = function (name, callback, keep) {
|
||||
meta.callbacks[name] = {
|
||||
func: callback,
|
||||
keep: keep,
|
||||
};
|
||||
};
|
||||
|
||||
exports.onlaunchtrigger = function () {
|
||||
for (var x in meta.callbacks) {
|
||||
if (typeof meta.callbacks[x].func === "function") {
|
||||
meta.callbacks[x].func();
|
||||
|
||||
// delete if it should not be kept.
|
||||
if (!meta.callbacks[x].keep) {
|
||||
delete meta.callbacks[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.switch_to_stream_row = function (stream_id) {
|
||||
var stream_row = row_for_stream_id(stream_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user