Remove onStatusMessageChanged handler
It's no longer necessary and calls a method that doesn't exist anymore.
This commit is contained in:
parent
68f0be996f
commit
c8304497b5
@ -34,10 +34,11 @@ When leaving a MUC, the message history is deleted. This means that decrypted
|
|||||||
OMEMO messages are gone and cannot be recovered on that device. See [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave).
|
OMEMO messages are gone and cannot be recovered on that device. See [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave).
|
||||||
|
|
||||||
Removed events:
|
Removed events:
|
||||||
* `chatBoxInsertedIntoDOM`
|
|
||||||
* `bookmarkViewsInitialized`
|
* `bookmarkViewsInitialized`
|
||||||
* `rosterGroupsFetched`
|
* `chatBoxInsertedIntoDOM`
|
||||||
|
* `contactStatusMessageChanged`
|
||||||
* `messageSend` (use `sendMessage` instead)
|
* `messageSend` (use `sendMessage` instead)
|
||||||
|
* `rosterGroupsFetched`
|
||||||
|
|
||||||
The `chatBoxClosed`, `chatBoxMaximized` and `chatBoxMinimized` events now have the `model` as
|
The `chatBoxClosed`, `chatBoxMaximized` and `chatBoxMinimized` events now have the `model` as
|
||||||
payload and not the `view`.
|
payload and not the `view`.
|
||||||
|
@ -25,7 +25,6 @@ export default class ChatView extends BaseChatView {
|
|||||||
this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
|
this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
|
||||||
this.listenTo(this.model, 'change:hidden', () => !this.model.get('hidden') && this.afterShown());
|
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);
|
||||||
this.listenTo(this.model, 'change:status', this.onStatusMessageChanged);
|
|
||||||
|
|
||||||
await this.model.messages.fetched;
|
await this.model.messages.fetched;
|
||||||
!this.model.get('hidden') && this.afterShown()
|
!this.model.get('hidden') && this.afterShown()
|
||||||
|
@ -21,6 +21,7 @@ export default class ChatHeading extends ElementView {
|
|||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
this.model = _converse.chatboxes.get(this.getAttribute('jid'));
|
this.model = _converse.chatboxes.get(this.getAttribute('jid'));
|
||||||
this.debouncedRender = debounce(this.render, 100);
|
this.debouncedRender = debounce(this.render, 100);
|
||||||
|
this.listenTo(this.model, 'change:status', this.debouncedRender);
|
||||||
this.listenTo(this.model, 'vcard:change', this.debouncedRender);
|
this.listenTo(this.model, 'vcard:change', this.debouncedRender);
|
||||||
if (this.model.contact) {
|
if (this.model.contact) {
|
||||||
this.listenTo(this.model.contact, 'destroy', this.debouncedRender);
|
this.listenTo(this.model.contact, 'destroy', this.debouncedRender);
|
||||||
|
@ -22,10 +22,10 @@ export default class MUCView extends BaseChatView {
|
|||||||
this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
|
this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
|
||||||
this.listenTo(this.model, 'change:composing_spoiler', this.requestUpdateMessageForm);
|
this.listenTo(this.model, 'change:composing_spoiler', this.requestUpdateMessageForm);
|
||||||
this.listenTo(this.model, 'show', this.show);
|
this.listenTo(this.model, 'show', this.show);
|
||||||
this.listenTo(this.model.session, 'change:connection_status', this.updateAfterTransition);
|
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.updateAfterTransition();
|
this.onConnectionStatusChanged();
|
||||||
this.model.maybeShow();
|
this.model.maybeShow();
|
||||||
/**
|
/**
|
||||||
* Triggered once a { @link _converse.ChatRoomView } has been opened
|
* Triggered once a { @link _converse.ChatRoomView } has been opened
|
||||||
@ -71,7 +71,7 @@ export default class MUCView extends BaseChatView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAfterTransition () {
|
onConnectionStatusChanged () {
|
||||||
const conn_status = this.model.session.get('connection_status');
|
const conn_status = this.model.session.get('connection_status');
|
||||||
if (conn_status === converse.ROOMSTATUS.CONNECTING) {
|
if (conn_status === converse.ROOMSTATUS.CONNECTING) {
|
||||||
this.model.session.save({
|
this.model.session.save({
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*global mock, converse, _ */
|
/*global mock, converse */
|
||||||
|
|
||||||
const $pres = converse.env.$pres;
|
const $pres = converse.env.$pres;
|
||||||
const $iq = converse.env.$iq;
|
const $iq = converse.env.$iq;
|
||||||
@ -2602,14 +2602,10 @@ describe("Groupchats", function () {
|
|||||||
// have the same attributes values as the original ones.
|
// have the same attributes values as the original ones.
|
||||||
const attrs = ['id', 'box_id', 'visible'];
|
const attrs = ['id', 'box_id', 'visible'];
|
||||||
let new_attrs, old_attrs;
|
let new_attrs, old_attrs;
|
||||||
for (var i=0; i<attrs.length; i++) {
|
for (let i=0; i<attrs.length; i++) {
|
||||||
new_attrs = _.map(_.map(newchatboxes.models, 'attributes'), attrs[i]);
|
new_attrs = newchatboxes.models.map(m => m.attributes[attrs[i]]);
|
||||||
old_attrs = _.map(_.map(_converse.chatboxes.models, 'attributes'), attrs[i]);
|
old_attrs = _converse.chatboxes.models.map(m => m.attributes[attrs[i]]);
|
||||||
// FIXME: should have have to sort here? Order must
|
expect(new_attrs.sort()).toEqual(old_attrs.sort());
|
||||||
// probably be the same...
|
|
||||||
// This should be fixed once the controlbox always opens
|
|
||||||
// only on the right.
|
|
||||||
expect(_.isEqual(new_attrs.sort(), old_attrs.sort())).toEqual(true);
|
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}));
|
}));
|
||||||
@ -2619,13 +2615,13 @@ describe("Groupchats", function () {
|
|||||||
|
|
||||||
await mock.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
await mock.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||||
spyOn(view, 'close').and.callThrough();
|
spyOn(view.model, 'close').and.callThrough();
|
||||||
spyOn(_converse.api, "trigger").and.callThrough();
|
spyOn(_converse.api, "trigger").and.callThrough();
|
||||||
spyOn(view.model, 'leave');
|
spyOn(view.model, 'leave');
|
||||||
spyOn(_converse.api, 'confirm').and.callFake(() => Promise.resolve(true));
|
spyOn(_converse.api, 'confirm').and.callFake(() => Promise.resolve(true));
|
||||||
const button = await u.waitUntil(() => view.querySelector('.close-chatbox-button'));
|
const button = await u.waitUntil(() => view.querySelector('.close-chatbox-button'));
|
||||||
button.click();
|
button.click();
|
||||||
await u.waitUntil(() => view.close.calls.count());
|
await u.waitUntil(() => view.model.close.calls.count());
|
||||||
expect(view.model.leave).toHaveBeenCalled();
|
expect(view.model.leave).toHaveBeenCalled();
|
||||||
await u.waitUntil(() => _converse.api.trigger.calls.count());
|
await u.waitUntil(() => _converse.api.trigger.calls.count());
|
||||||
expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxClosed', jasmine.any(Object));
|
expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxClosed', jasmine.any(Object));
|
||||||
@ -4460,7 +4456,7 @@ describe("Groupchats", function () {
|
|||||||
modal.el.querySelector('form input[type="submit"]').click();
|
modal.el.querySelector('form input[type="submit"]').click();
|
||||||
await u.waitUntil(() => _converse.chatboxes.length);
|
await u.waitUntil(() => _converse.chatboxes.length);
|
||||||
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 1);
|
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 1);
|
||||||
expect(_.includes(_converse.chatboxes.models.map(m => m.get('id')), 'lounge@muc.example.org')).toBe(true);
|
expect(_converse.chatboxes.models.map(m => m.get('id')).includes('lounge@muc.example.org')).toBe(true);
|
||||||
|
|
||||||
// However, you can still open MUCs with different domains
|
// However, you can still open MUCs with different domains
|
||||||
roomspanel.querySelector('.show-add-muc-modal').click();
|
roomspanel.querySelector('.show-add-muc-modal').click();
|
||||||
@ -4472,7 +4468,7 @@ describe("Groupchats", function () {
|
|||||||
modal.el.querySelector('form input[type="submit"]').click();
|
modal.el.querySelector('form input[type="submit"]').click();
|
||||||
await u.waitUntil(() => _converse.chatboxes.models.filter(c => c.get('type') === 'chatroom').length === 2);
|
await u.waitUntil(() => _converse.chatboxes.models.filter(c => c.get('type') === 'chatroom').length === 2);
|
||||||
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 2);
|
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 2);
|
||||||
expect(_.includes(_converse.chatboxes.models.map(m => m.get('id')), 'lounge@conference.example.org')).toBe(true);
|
expect(_converse.chatboxes.models.map(m => m.get('id')).includes('lounge@conference.example.org')).toBe(true);
|
||||||
done();
|
done();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -4498,7 +4494,7 @@ describe("Groupchats", function () {
|
|||||||
modal.el.querySelector('form input[type="submit"]').click();
|
modal.el.querySelector('form input[type="submit"]').click();
|
||||||
await u.waitUntil(() => _converse.chatboxes.length);
|
await u.waitUntil(() => _converse.chatboxes.length);
|
||||||
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 1);
|
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 1);
|
||||||
expect(_.includes(_converse.chatboxes.models.map(m => m.get('id')), 'lounge@muc.example.org')).toBe(true);
|
expect(_converse.chatboxes.models.map(m => m.get('id')).includes('lounge@muc.example.org')).toBe(true);
|
||||||
|
|
||||||
// However, you can still open MUCs with different domains
|
// However, you can still open MUCs with different domains
|
||||||
roomspanel.querySelector('.show-add-muc-modal').click();
|
roomspanel.querySelector('.show-add-muc-modal').click();
|
||||||
@ -4510,7 +4506,7 @@ describe("Groupchats", function () {
|
|||||||
modal.el.querySelector('form input[type="submit"]').click();
|
modal.el.querySelector('form input[type="submit"]').click();
|
||||||
await u.waitUntil(() => _converse.chatboxes.models.filter(c => c.get('type') === 'chatroom').length === 2);
|
await u.waitUntil(() => _converse.chatboxes.models.filter(c => c.get('type') === 'chatroom').length === 2);
|
||||||
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 2);
|
await u.waitUntil(() => sizzle('.chatroom', _converse.el).filter(u.isVisible).length === 2);
|
||||||
expect(_.includes(_converse.chatboxes.models.map(m => m.get('id')), 'lounge\\40conference@muc.example.org')).toBe(true);
|
expect(_converse.chatboxes.models.map(m => m.get('id')).includes('lounge\\40conference@muc.example.org')).toBe(true);
|
||||||
done();
|
done();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -72,22 +72,6 @@ export default class BaseChatView extends CustomElement {
|
|||||||
api.trigger('chatBoxFocused', this, ev);
|
api.trigger('chatBoxFocused', this, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
onStatusMessageChanged (item) {
|
|
||||||
this.renderHeading();
|
|
||||||
/**
|
|
||||||
* When a contact's custom status message has changed.
|
|
||||||
* @event _converse#contactStatusMessageChanged
|
|
||||||
* @type {object}
|
|
||||||
* @property { object } contact - The chat buddy
|
|
||||||
* @property { string } message - The message text
|
|
||||||
* @example _converse.api.listen.on('contactStatusMessageChanged', obj => { ... });
|
|
||||||
*/
|
|
||||||
api.trigger('contactStatusMessageChanged', {
|
|
||||||
'contact': item.attributes,
|
|
||||||
'message': item.get('status')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getBottomPanel () {
|
getBottomPanel () {
|
||||||
if (this.model.get('type') === _converse.CHATROOMS_TYPE) {
|
if (this.model.get('type') === _converse.CHATROOMS_TYPE) {
|
||||||
return this.querySelector('converse-muc-bottom-panel');
|
return this.querySelector('converse-muc-bottom-panel');
|
||||||
|
Loading…
Reference in New Issue
Block a user