diff --git a/src/plugins/chatview/chat.js b/src/plugins/chatview/chat.js index da5c5bc12..faee2173d 100644 --- a/src/plugins/chatview/chat.js +++ b/src/plugins/chatview/chat.js @@ -19,7 +19,7 @@ export default class ChatView extends BaseChatView { this.model = _converse.chatboxes.get(this.jid); this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged); this.listenTo(this.model, 'change:hidden', () => !this.model.get('hidden') && this.afterShown()); - this.listenTo(this.model, 'change:show_help_messages', this.requestUpdate); + this.listenTo(this.model, 'change:show_help_messages', () => this.requestUpdate()); await this.model.messages.fetched; !this.model.get('hidden') && this.afterShown() diff --git a/src/plugins/chatview/heading.js b/src/plugins/chatview/heading.js index b34a027f8..070d43c68 100644 --- a/src/plugins/chatview/heading.js +++ b/src/plugins/chatview/heading.js @@ -17,14 +17,14 @@ export default class ChatHeading extends CustomElement { initialize () { this.model = _converse.chatboxes.get(this.jid); - this.listenTo(this.model, 'change:status', this.requestUpdate); - this.listenTo(this.model, 'vcard:add', this.requestUpdate); - this.listenTo(this.model, 'vcard:change', this.requestUpdate); + this.listenTo(this.model, 'change:status', () => this.requestUpdate()); + this.listenTo(this.model, 'vcard:add', () => this.requestUpdate()); + this.listenTo(this.model, 'vcard:change', () => this.requestUpdate()); if (this.model.contact) { - this.listenTo(this.model.contact, 'destroy', this.requestUpdate); + this.listenTo(this.model.contact, 'destroy', () => this.requestUpdate()); } this.model.rosterContactAdded?.then(() => { - this.listenTo(this.model.contact, 'change:nickname', this.requestUpdate); + this.listenTo(this.model.contact, 'change:nickname', () => this.requestUpdate()); this.requestUpdate(); }); } diff --git a/src/plugins/headlines-view/view.js b/src/plugins/headlines-view/view.js index 523186068..129872171 100644 --- a/src/plugins/headlines-view/view.js +++ b/src/plugins/headlines-view/view.js @@ -13,9 +13,9 @@ class HeadlinesFeedView extends BaseChatView { this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged); this.listenTo(this.model, 'change:hidden', () => this.afterShown()); this.listenTo(this.model, 'destroy', this.remove); - this.listenTo(this.model.messages, 'add', this.requestUpdate); - this.listenTo(this.model.messages, 'remove', this.requestUpdate); - this.listenTo(this.model.messages, 'reset', this.requestUpdate); + this.listenTo(this.model.messages, 'add', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'remove', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'reset', () => this.requestUpdate()); await this.model.messages.fetched; this.model.maybeShow(); diff --git a/src/plugins/minimize/view.js b/src/plugins/minimize/view.js index 4fac70b8e..831ca7847 100644 --- a/src/plugins/minimize/view.js +++ b/src/plugins/minimize/view.js @@ -10,18 +10,18 @@ export default class MinimizedChats extends CustomElement { async initialize () { this.model = _converse.chatboxes; await this.initToggle(); - this.listenTo(this.minchats, 'change:collapsed', this.requestUpdate) - this.listenTo(this.model, 'add', this.requestUpdate) - this.listenTo(this.model, 'change:fullname', this.requestUpdate) - this.listenTo(this.model, 'change:jid', this.requestUpdate) - this.listenTo(this.model, 'change:minimized', this.requestUpdate) - this.listenTo(this.model, 'change:name', this.requestUpdate) - this.listenTo(this.model, 'change:num_unread', this.requestUpdate) - this.listenTo(this.model, 'remove', this.requestUpdate) + this.listenTo(this.minchats, 'change:collapsed', () => this.requestUpdate()) + this.listenTo(this.model, 'add', () => this.requestUpdate()) + this.listenTo(this.model, 'change:fullname', () => this.requestUpdate()) + this.listenTo(this.model, 'change:jid', () => this.requestUpdate()) + this.listenTo(this.model, 'change:minimized', () => this.requestUpdate()) + this.listenTo(this.model, 'change:name', () => this.requestUpdate()) + this.listenTo(this.model, 'change:num_unread', () => this.requestUpdate()) + this.listenTo(this.model, 'remove', () => this.requestUpdate()) - this.listenTo(_converse, 'connected', this.requestUpdate); - this.listenTo(_converse, 'reconnected', this.requestUpdate); - this.listenTo(_converse, 'disconnected', this.requestUpdate); + this.listenTo(_converse, 'connected', () => this.requestUpdate()); + this.listenTo(_converse, 'reconnected', () => this.requestUpdate()); + this.listenTo(_converse, 'disconnected', () => this.requestUpdate()); } render () { diff --git a/src/plugins/muc-views/config-form.js b/src/plugins/muc-views/config-form.js index 02aecc2e8..d5a630fd9 100644 --- a/src/plugins/muc-views/config-form.js +++ b/src/plugins/muc-views/config-form.js @@ -19,8 +19,8 @@ class MUCConfigForm extends CustomElement { connectedCallback () { super.connectedCallback(); this.model = _converse.chatboxes.get(this.jid); - this.listenTo(this.model.features, 'change:passwordprotected', this.requestUpdate); - this.listenTo(this.model.session, 'change:config_stanza', this.requestUpdate); + this.listenTo(this.model.features, 'change:passwordprotected', () => this.requestUpdate()); + this.listenTo(this.model.session, 'change:config_stanza', () => this.requestUpdate()); this.getConfig(); } diff --git a/src/plugins/muc-views/muc.js b/src/plugins/muc-views/muc.js index 2bd74bdb2..20eb881b6 100644 --- a/src/plugins/muc-views/muc.js +++ b/src/plugins/muc-views/muc.js @@ -15,7 +15,7 @@ export default class MUCView extends BaseChatView { this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged); this.listenTo(this.model, 'change:composing_spoiler', this.requestUpdateMessageForm); this.listenTo(this.model.session, 'change:connection_status', this.onConnectionStatusChanged); - this.listenTo(this.model.session, 'change:view', this.requestUpdate); + this.listenTo(this.model.session, 'change:view', () => this.requestUpdate()); this.onConnectionStatusChanged(); this.model.maybeShow(); diff --git a/src/plugins/muc-views/sidebar.js b/src/plugins/muc-views/sidebar.js index 1cac50ebb..dfb86a5aa 100644 --- a/src/plugins/muc-views/sidebar.js +++ b/src/plugins/muc-views/sidebar.js @@ -19,11 +19,11 @@ export default class MUCSidebar extends CustomElement { connectedCallback () { super.connectedCallback(); this.model = _converse.chatboxes.get(this.jid); - this.listenTo(this.model.occupants, 'add', this.requestUpdate); - this.listenTo(this.model.occupants, 'remove', this.requestUpdate); - this.listenTo(this.model.occupants, 'change', this.requestUpdate); - this.listenTo(this.model.occupants, 'vcard:change', this.requestUpdate); - this.listenTo(this.model.occupants, 'vcard:add', this.requestUpdate); + this.listenTo(this.model.occupants, 'add', () => this.requestUpdate()); + this.listenTo(this.model.occupants, 'remove', () => this.requestUpdate()); + this.listenTo(this.model.occupants, 'change', () => this.requestUpdate()); + this.listenTo(this.model.occupants, 'vcard:change', () => this.requestUpdate()); + this.listenTo(this.model.occupants, 'vcard:add', () => this.requestUpdate()); this.model.initialized.then(() => this.requestUpdate()); } diff --git a/src/plugins/omemo/fingerprints.js b/src/plugins/omemo/fingerprints.js index 411feca22..848c0fa2b 100644 --- a/src/plugins/omemo/fingerprints.js +++ b/src/plugins/omemo/fingerprints.js @@ -12,11 +12,11 @@ export class Fingerprints extends CustomElement { async initialize () { this.devicelist = await api.omemo.devicelists.get(this.jid, true); - this.listenTo(this.devicelist.devices, 'change:bundle', this.requestUpdate); - this.listenTo(this.devicelist.devices, 'change:trusted', this.requestUpdate); - this.listenTo(this.devicelist.devices, 'remove', this.requestUpdate); - this.listenTo(this.devicelist.devices, 'add', this.requestUpdate); - this.listenTo(this.devicelist.devices, 'reset', this.requestUpdate); + this.listenTo(this.devicelist.devices, 'change:bundle', () => this.requestUpdate()); + this.listenTo(this.devicelist.devices, 'change:trusted', () => this.requestUpdate()); + this.listenTo(this.devicelist.devices, 'remove', () => this.requestUpdate()); + this.listenTo(this.devicelist.devices, 'add', () => this.requestUpdate()); + this.listenTo(this.devicelist.devices, 'reset', () => this.requestUpdate()); this.requestUpdate(); } diff --git a/src/plugins/profile/statusview.js b/src/plugins/profile/statusview.js index 1897f50da..d4102217c 100644 --- a/src/plugins/profile/statusview.js +++ b/src/plugins/profile/statusview.js @@ -7,9 +7,9 @@ class Profile extends CustomElement { initialize () { this.model = _converse.xmppstatus; - this.listenTo(this.model, "change", this.requestUpdate); - this.listenTo(this.model, "vcard:add", this.requestUpdate); - this.listenTo(this.model, "vcard:change", this.requestUpdate); + this.listenTo(this.model, "change", () => this.requestUpdate()); + this.listenTo(this.model, "vcard:add", () => this.requestUpdate()); + this.listenTo(this.model, "vcard:change", () => this.requestUpdate()); } render () { diff --git a/src/plugins/rosterview/rosterview.js b/src/plugins/rosterview/rosterview.js index 1c1308f90..de6944389 100644 --- a/src/plugins/rosterview/rosterview.js +++ b/src/plugins/rosterview/rosterview.js @@ -13,13 +13,13 @@ export default class RosterView extends CustomElement { async initialize () { await api.waitUntil('rosterInitialized') - this.listenTo(_converse, 'rosterContactsFetched', this.requestUpdate); - this.listenTo(_converse.presences, 'change:show', this.requestUpdate); - this.listenTo(_converse.roster, 'add', this.requestUpdate); - this.listenTo(_converse.roster, 'destroy', this.requestUpdate); - this.listenTo(_converse.roster, 'remove', this.requestUpdate); - this.listenTo(_converse.roster, 'change', this.requestUpdate); - this.listenTo(_converse.roster.state, 'change', this.requestUpdate); + this.listenTo(_converse, 'rosterContactsFetched', () => this.requestUpdate()); + this.listenTo(_converse.presences, 'change:show', () => this.requestUpdate()); + this.listenTo(_converse.roster, 'add', () => this.requestUpdate()); + this.listenTo(_converse.roster, 'destroy', () => this.requestUpdate()); + this.listenTo(_converse.roster, 'remove', () => this.requestUpdate()); + this.listenTo(_converse.roster, 'change', () => this.requestUpdate()); + this.listenTo(_converse.roster.state, 'change', () => this.requestUpdate()); /** * Triggered once the _converse.RosterView instance has been created and initialized. * @event _converse#rosterViewInitialized diff --git a/src/shared/chat/chat-content.js b/src/shared/chat/chat-content.js index 095ed1ed5..29618793c 100644 --- a/src/shared/chat/chat-content.js +++ b/src/shared/chat/chat-content.js @@ -23,18 +23,18 @@ export default class ChatContent extends CustomElement { async initialize () { await this.setModels(); - this.listenTo(this.model, 'change:hidden_occupants', this.requestUpdate); - this.listenTo(this.model.messages, 'add', this.requestUpdate); - this.listenTo(this.model.messages, 'change', this.requestUpdate); - this.listenTo(this.model.messages, 'remove', this.requestUpdate); - this.listenTo(this.model.messages, 'rendered', this.requestUpdate); - this.listenTo(this.model.messages, 'reset', this.requestUpdate); - this.listenTo(this.model.notifications, 'change', this.requestUpdate); - this.listenTo(this.model.ui, 'change', this.requestUpdate); + this.listenTo(this.model, 'change:hidden_occupants', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'add', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'change', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'remove', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'rendered', () => this.requestUpdate()); + this.listenTo(this.model.messages, 'reset', () => this.requestUpdate()); + this.listenTo(this.model.notifications, 'change', () => this.requestUpdate()); + this.listenTo(this.model.ui, 'change', () => this.requestUpdate()); this.listenTo(this.model.ui, 'change:scrolled', this.scrollDown); if (this.model.occupants) { - this.listenTo(this.model.occupants, 'change', this.requestUpdate); + this.listenTo(this.model.occupants, 'change', () => this.requestUpdate()); } this.addEventListener('scroll', markScrolled); } diff --git a/src/shared/chat/message-limit.js b/src/shared/chat/message-limit.js index 09fcdde02..23fa98681 100644 --- a/src/shared/chat/message-limit.js +++ b/src/shared/chat/message-limit.js @@ -12,7 +12,7 @@ export default class MessageLimitIndicator extends CustomElement { connectedCallback () { super.connectedCallback(); - this.listenTo(this.model, 'change:draft', this.requestUpdate); + this.listenTo(this.model, 'change:draft', () => this.requestUpdate()); } render () {