Remove the `messageSend` event

This commit is contained in:
JC Brand 2021-04-08 10:00:05 +02:00
parent 724a6855ed
commit 24e57244d1
5 changed files with 3 additions and 13 deletions

View File

@ -33,6 +33,7 @@ Removed events:
* `chatBoxInsertedIntoDOM`
* `bookmarkViewsInitialized`
* `rosterGroupsFetched`
* `messageSend` (use `sendMessage` instead)
The `chatBoxMaximized` and `chatBoxMinimized` events now have the `model` as
payload and not the `view` since it might not be exist at that time.

View File

@ -940,8 +940,7 @@ describe("Chatboxes", function () {
});
expect(window.confirm).toHaveBeenCalledWith('Are you sure you want to clear the messages from this conversation?');
await u.waitUntil(() => view.model.messages.length === 0);
expect(_converse.api.trigger.calls.count(), 1);
expect(_converse.api.trigger.calls.mostRecent().args, ['messageSend', message]);
await u.waitUntil(() => !view.querySelectorAll('.chat-msg__body').length);
done();
}));
});

View File

@ -936,7 +936,6 @@ describe("A Chat Message", function () {
await mock.sendMessage(view, message);
expect(view.model.sendMessage).toHaveBeenCalled();
expect(view.model.messages.length, 2);
expect(_converse.api.trigger.calls.mostRecent().args, ['messageSend', message]);
expect(sizzle('.chat-content .chat-msg:last .chat-msg__text', view).pop().textContent).toEqual(message);
done();
}));

View File

@ -1903,7 +1903,7 @@ describe("Groupchats", function () {
});
await u.waitUntil(() => view.querySelectorAll('.chat-msg__text').length);
expect(_converse.api.trigger).toHaveBeenCalledWith('messageSend', jasmine.any(_converse.Message));
expect(_converse.api.trigger).toHaveBeenCalledWith('sendMessage', jasmine.any(Object));
expect(view.querySelectorAll('.chat-msg').length).toBe(1);
// Let's check that if we receive the same message again, it's

View File

@ -186,15 +186,6 @@ export default class ChatBottomPanel extends ElementView {
textarea.style.height = 'auto';
this.updateCharCounter(textarea.value);
}
if (message) {
/**
* Triggered whenever a message is sent by the user
* @event _converse#messageSend
* @type { _converse.Message }
* @example _converse.api.listen.on('messageSend', message => { ... });
*/
api.trigger('messageSend', message);
}
if (api.settings.get('view_mode') === 'overlayed') {
// XXX: Chrome flexbug workaround. The .chat-content area
// doesn't resize when the textarea is resized to its original size.