headlines-view: Update to match changes to the normal chat view
This commit is contained in:
parent
fbc4adff99
commit
4f7ff1f3cf
@ -111,6 +111,7 @@ describe("Notifications", function () {
|
||||
.c('x', {'xmlns': 'jabber:x:oob'})
|
||||
.c('url').t('imap://romeo@example.com/INBOX;UIDVALIDITY=385759043/;UID=18');
|
||||
_converse.connection._dataRecv(mock.createRequest(stanza));
|
||||
|
||||
await u.waitUntil(() => _converse.chatboxviews.keys().length);
|
||||
const view = _converse.chatboxviews.get('notify.example.com');
|
||||
await new Promise(resolve => view.model.messages.once('rendered', resolve));
|
||||
|
@ -28,13 +28,18 @@ const HeadlinesBoxView = ChatBoxView.extend({
|
||||
this.initDebounced();
|
||||
|
||||
this.model.disable_mam = true; // Don't do MAM queries for this box
|
||||
this.listenTo(this.model.messages, 'add', this.renderChatHistory);
|
||||
this.listenTo(this.model, 'change:hidden', m => m.get('hidden') ? this.hide() : this.show());
|
||||
this.listenTo(this.model, 'destroy', this.remove);
|
||||
this.listenTo(this.model, 'show', this.show);
|
||||
this.listenTo(this.model, 'destroy', this.hide);
|
||||
this.listenTo(this.model, 'change:minimized', this.onMinimizedChanged);
|
||||
|
||||
this.render();
|
||||
this.renderHeading();
|
||||
|
||||
// Need to be registered after render has been called.
|
||||
this.listenTo(this.model.messages, 'add', this.onMessageAdded);
|
||||
this.listenTo(this.model.messages, 'remove', this.renderChatHistory);
|
||||
this.listenTo(this.model.messages, 'rendered', this.maybeScrollDown);
|
||||
this.listenTo(this.model.messages, 'reset', this.renderChatHistory);
|
||||
|
||||
await this.model.messages.fetched;
|
||||
this.insertIntoDOM();
|
||||
this.model.maybeShow();
|
||||
@ -62,6 +67,8 @@ const HeadlinesBoxView = ChatBoxView.extend({
|
||||
render(result, this.el);
|
||||
this.content = this.el.querySelector('.chat-content');
|
||||
this.msgs_container = this.el.querySelector('.chat-content__messages');
|
||||
this.renderChatContent();
|
||||
this.renderHeading();
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -63,9 +63,10 @@ converse.plugins.add('converse-headlines', {
|
||||
}
|
||||
},
|
||||
|
||||
initialize () {
|
||||
this.initMessages();
|
||||
async initialize () {
|
||||
this.set({'box_id': `box-${this.get('jid')}`});
|
||||
this.initMessages();
|
||||
await this.fetchMessages();
|
||||
/**
|
||||
* Triggered once a {@link _converse.HeadlinesBox} has been created and initialized.
|
||||
* @event _converse#headlinesBoxInitialized
|
||||
|
Loading…
Reference in New Issue
Block a user