mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
alert_words: Remove the page_params.alert_words after initialization.
We remove the `page_params.alert_words` since `alert_words.words` is the sole source of alert words. Use of `page_params.alert_words` could lead to bugs when alert words are updated since it is not updated.
This commit is contained in:
committed by
Tim Abbott
parent
0e25634934
commit
d5ab8ac1e1
@@ -4,6 +4,9 @@ var exports = {};
|
|||||||
|
|
||||||
exports.words = page_params.alert_words;
|
exports.words = page_params.alert_words;
|
||||||
|
|
||||||
|
// Delete the `page_params.alert_words` since we are its sole user.
|
||||||
|
delete page_params.alert_words;
|
||||||
|
|
||||||
// escape_user_regex taken from jquery-ui/autocomplete.js,
|
// escape_user_regex taken from jquery-ui/autocomplete.js,
|
||||||
// licensed under MIT license.
|
// licensed under MIT license.
|
||||||
function escape_user_regex(value) {
|
function escape_user_regex(value) {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ var alert_words_ui = (function () {
|
|||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
exports.render_alert_words_ui = function () {
|
exports.render_alert_words_ui = function () {
|
||||||
var alert_words = page_params.alert_words;
|
var words = alert_words.words;
|
||||||
var word_list = $('#alert_words_list');
|
var word_list = $('#alert_words_list');
|
||||||
|
|
||||||
word_list.find('.alert-word-item').remove();
|
word_list.find('.alert-word-item').remove();
|
||||||
_.each(alert_words, function (alert_word) {
|
_.each(words, function (alert_word) {
|
||||||
var rendered_alert_word = templates.render('alert_word_settings_item',
|
var rendered_alert_word = templates.render('alert_word_settings_item',
|
||||||
{word: alert_word, editing: false});
|
{word: alert_word, editing: false});
|
||||||
word_list.append(rendered_alert_word);
|
word_list.append(rendered_alert_word);
|
||||||
|
|||||||
Reference in New Issue
Block a user