|
@@ -196,6 +196,7 @@ converse.plugins.add('converse-chatview', {
|
|
this.initDebounced();
|
|
this.initDebounced();
|
|
|
|
|
|
this.listenTo(this.model.messages, 'add', this.onMessageAdded);
|
|
this.listenTo(this.model.messages, 'add', this.onMessageAdded);
|
|
|
|
+ this.listenTo(this.model.messages, 'change:edited', this.onMessageEdited);
|
|
this.listenTo(this.model.messages, 'rendered', this.scrollDown);
|
|
this.listenTo(this.model.messages, 'rendered', this.scrollDown);
|
|
this.model.messages.on('reset', () => {
|
|
this.model.messages.on('reset', () => {
|
|
this.content.innerHTML = '';
|
|
this.content.innerHTML = '';
|
|
@@ -724,8 +725,7 @@ converse.plugins.add('converse-chatview', {
|
|
await message.initialized;
|
|
await message.initialized;
|
|
const view = this.add(message.get('id'), new _converse.MessageView({'model': message}));
|
|
const view = this.add(message.get('id'), new _converse.MessageView({'model': message}));
|
|
await view.render();
|
|
await view.render();
|
|
- // Clear chat state notifications
|
|
|
|
- sizzle(`.chat-state-notification[data-csn="${message.get('from')}"]`, this.content).forEach(u.removeElement);
|
|
|
|
|
|
+ this.clearChatStateForSender(message.get('from'));
|
|
this.insertMessage(view);
|
|
this.insertMessage(view);
|
|
this.insertDayIndicator(view.el);
|
|
this.insertDayIndicator(view.el);
|
|
this.setScrollPosition(view.el);
|
|
this.setScrollPosition(view.el);
|
|
@@ -780,6 +780,16 @@ converse.plugins.add('converse-chatview', {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Handler that gets called when a message object has been edited via LMC.
|
|
|
|
+ * @private
|
|
|
|
+ * @method _converse.ChatBoxView#onMessageEdited
|
|
|
|
+ * @param { object } message - The updated message object.
|
|
|
|
+ */
|
|
|
|
+ onMessageEdited (message) {
|
|
|
|
+ this.clearChatStateForSender(message.get('from'));
|
|
|
|
+ },
|
|
|
|
+
|
|
parseMessageForCommands (text) {
|
|
parseMessageForCommands (text) {
|
|
const match = text.replace(/^\s*/, "").match(/^\/(.*)\s*$/);
|
|
const match = text.replace(/^\s*/, "").match(/^\/(.*)\s*$/);
|
|
if (match) {
|
|
if (match) {
|
|
@@ -1072,6 +1082,16 @@ converse.plugins.add('converse-chatview', {
|
|
return this;
|
|
return this;
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Remove chat state notifications for a given sender JID.
|
|
|
|
+ * @private
|
|
|
|
+ * @method _converse.ChatBoxView#clearChatStateForSender
|
|
|
|
+ * @param {string} sender - The sender of the chat state
|
|
|
|
+ */
|
|
|
|
+ clearChatStateForSender (sender) {
|
|
|
|
+ sizzle(`.chat-state-notification[data-csn="${sender}"]`, this.content).forEach(u.removeElement);
|
|
|
|
+ },
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Insert a particular string value into the textarea of this chat box.
|
|
* Insert a particular string value into the textarea of this chat box.
|
|
* @private
|
|
* @private
|