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:
Steve Howell
2018-12-02 18:59:59 +00:00
committed by Tim Abbott
parent 623e3f3c9f
commit ec3f6434a6
2 changed files with 2 additions and 32 deletions

View File

@@ -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

View File

@@ -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);