Commit 00466cd5 authored by JC Brand's avatar JC Brand

Let the `converse-loaded` event conform to the CustomEvent spec

https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
parent 5a2d361c
......@@ -1670,6 +1670,7 @@ For example:
initConverse(shadowRoot) {
window.addEventListener("converse-loaded", function(event) {
const { converse } = event.detail;
converse.initialize({
root: shadowRoot,
// Other settings go here...
......
......@@ -121,7 +121,6 @@ export default class MessageHistory extends CustomElement {
}
renderMessage (model) {
// XXX: leaky abstraction "is_only_key" from converse-omemo
if (model.get('dangling_retraction') || model.get('is_only_key')) {
return '';
}
......
......@@ -578,11 +578,8 @@ converse.plugins.add('converse-chat', {
},
updateMessage (message, attrs) {
// Overridden in converse-muc and converse-mam
const new_attrs = this.getUpdatedMessageAttributes(message, attrs);
if (attrs) {
message.save(new_attrs);
}
new_attrs && message.save(new_attrs);
},
/**
......
......@@ -1655,6 +1655,5 @@ Object.assign(converse, {
* @event converse-loaded
* @example window.addEventListener('converse-loaded', () => converse.initialize());
*/
const ev = new CustomEvent('converse-loaded')
ev.converse = converse;
const ev = new CustomEvent('converse-loaded', {'detail': { converse }});
window.dispatchEvent(ev);
......@@ -1795,7 +1795,6 @@ converse.plugins.add('converse-muc', {
getUpdatedMessageAttributes (message, attrs) {
// Overridden in converse-muc and converse-mam
const new_attrs = _converse.ChatBox.prototype.getUpdatedMessageAttributes.call(this, message, attrs);
if (this.isOwnMessage(attrs)) {
const stanza_id_keys = Object.keys(attrs).filter(k => k.startsWith('stanza_id'));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment