Wait for parseMessages before queuing to UI (#2803)

* parse messages before queuing

* update CHANGES

* remove unused variable

Co-authored-by: aFriedmanGlacier <afriedman@glaciersecurity.com>
This commit is contained in:
afriedmanGlacier 2022-02-05 16:02:24 -05:00 committed by GitHub
parent 337638034f
commit 3d8a583101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,7 @@
- #2786: Fix webpack configuration not working on Windows OS
- #2788: `TypeError` when trying to use `@converse/headless`
- #2789: Implement new hook `parseMessageForCommands` for plugins to add custom commands
- #2733: Wait for decrypted/parsed message before queuing to UI
## 9.0.0 (2021-11-26)

View File

@ -77,9 +77,11 @@ export function preMUCJoinMAMFetch (muc) {
export async function handleMAMResult (model, result, query, options, should_page) {
await api.emojis.initialize();
const is_muc = model.get('type') === _converse.CHATROOMS_TYPE;
result.messages = result.messages.map(s =>
is_muc ? parseMUCMessage(s, model, _converse) : parseMessage(s, _converse)
);
const doParseMessage = async (s) => {
return await (is_muc ? parseMUCMessage(s, model, _converse) : parseMessage(s, _converse))
}
await Promise.all(result.messages.map(doParseMessage));
/**
* Synchronous event which allows listeners to first do some

View File

@ -304,7 +304,7 @@ async function handleDecryptedWhisperMessage (attrs, key_and_tag) {
const from_jid = getJIDForDecryption(attrs);
const devicelist = await _converse.devicelists.getDeviceList(from_jid);
const encrypted = attrs.encrypted;
let device = devicelist.get(encrypted.device_id);
let device = devicelist.devices.get(encrypted.device_id);
if (!device) {
device = await devicelist.devices.create({ 'id': encrypted.device_id, 'jid': from_jid }, { 'promise': true });
}