|
@@ -12,12 +12,12 @@ export default class ChatContent extends CustomElement {
|
|
|
|
|
|
constructor () {
|
|
constructor () {
|
|
super();
|
|
super();
|
|
- this.jid = null;
|
|
|
|
|
|
+ this.model = null;
|
|
}
|
|
}
|
|
|
|
|
|
static get properties () {
|
|
static get properties () {
|
|
return {
|
|
return {
|
|
- jid: { type: String }
|
|
|
|
|
|
+ model: { type: Object }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -27,8 +27,7 @@ export default class ChatContent extends CustomElement {
|
|
}
|
|
}
|
|
|
|
|
|
async initialize () {
|
|
async initialize () {
|
|
- await this.setModels();
|
|
|
|
- this.listenTo(this.model, 'change:hidden_occupants', () => this.requestUpdate());
|
|
|
|
|
|
+ await this.model.initialized;
|
|
this.listenTo(this.model.messages, 'add', () => this.requestUpdate());
|
|
this.listenTo(this.model.messages, 'add', () => this.requestUpdate());
|
|
this.listenTo(this.model.messages, 'change', () => this.requestUpdate());
|
|
this.listenTo(this.model.messages, 'change', () => this.requestUpdate());
|
|
this.listenTo(this.model.messages, 'remove', () => this.requestUpdate());
|
|
this.listenTo(this.model.messages, 'remove', () => this.requestUpdate());
|
|
@@ -37,16 +36,7 @@ export default class ChatContent extends CustomElement {
|
|
this.listenTo(this.model.notifications, 'change', () => this.requestUpdate());
|
|
this.listenTo(this.model.notifications, 'change', () => this.requestUpdate());
|
|
this.listenTo(this.model.ui, 'change', () => this.requestUpdate());
|
|
this.listenTo(this.model.ui, 'change', () => this.requestUpdate());
|
|
this.listenTo(this.model.ui, 'change:scrolled', this.scrollDown);
|
|
this.listenTo(this.model.ui, 'change:scrolled', this.scrollDown);
|
|
-
|
|
|
|
- if (this.model.occupants) {
|
|
|
|
- this.listenTo(this.model.occupants, 'change', () => this.requestUpdate());
|
|
|
|
- }
|
|
|
|
this.addEventListener('scroll', markScrolled);
|
|
this.addEventListener('scroll', markScrolled);
|
|
- }
|
|
|
|
-
|
|
|
|
- async setModels () {
|
|
|
|
- this.model = await api.chatboxes.get(this.jid);
|
|
|
|
- await this.model.initialized;
|
|
|
|
this.requestUpdate();
|
|
this.requestUpdate();
|
|
}
|
|
}
|
|
|
|
|