stream_edit.js: Add helper func to check if sub settings tab is active.

This commit adds a new helper func to check if sub settings tab
is active or not and remove function `add_me_to_member_list`
function from `static/js/stream_edit.js`, cause we don't need to
render subscribers for particular case, as we are already doing that.
This commit is contained in:
YJDave 2018-04-06 10:18:46 +05:30 committed by Tim Abbott
parent 386c56b466
commit 211eba2c56
2 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,14 @@ function settings_for_sub(sub) {
return $("#subscription_overlay .subscription_settings[data-stream-id='" + id + "']");
}
exports.is_sub_settings_active = function (sub) {
var active_stream = subs.active_stream();
if (active_stream !== undefined && active_stream.id === sub.stream_id) {
return true;
}
return false;
};
function get_email_of_subscribers(subscribers) {
var emails = [];
subscribers.each(function (o, i) {

View File

@ -231,8 +231,7 @@ exports.update_settings_for_subscribed = function (sub) {
exports.add_sub_to_table(sub);
}
var active_stream = exports.active_stream();
if (active_stream !== undefined && active_stream.id === sub.stream_id) {
if (stream_edit.is_sub_settings_active(sub)) {
stream_edit.rerender_subscribers_list(sub);
}
@ -251,9 +250,8 @@ exports.update_settings_for_unsubscribed = function (sub) {
stream_edit.hide_sub_settings(sub);
var active_stream = exports.active_stream();
stream_data.update_stream_email_address(sub, "");
if (active_stream !== undefined && active_stream.id === sub.stream_id) {
if (stream_edit.is_sub_settings_active(sub)) {
stream_edit.rerender_subscribers_list(sub);
// If user unsubscribed from private stream then user cannot subscribe to