Commit 19b9aead authored by JC Brand's avatar JC Brand

Show an indicator that the message has been edited

parent 9f42f09d
...@@ -68988,7 +68988,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -68988,7 +68988,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}); });
if (replace) { if (replace) {
message.save('message', getMessageBody(stanza)); message.save({
'message': getMessageBody(stanza),
'older_versions': (message.get('older_versions') || []).push(message.get('message')),
'edited': true
});
} else if (!message) { } else if (!message) {
// Only create the message when we're sure it's not a duplicate // Only create the message when we're sure it's not a duplicate
chatbox.incrementUnreadMsgCounter(original_stanza); chatbox.incrementUnreadMsgCounter(original_stanza);
...@@ -74562,6 +74566,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -74562,6 +74566,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
role = this.model.vcard.get('role'), role = this.model.vcard.get('role'),
roles = role ? role.split(',') : []; roles = role ? role.split(',') : [];
const msg = u.stringToElement(template(_.extend(this.model.toJSON(), { const msg = u.stringToElement(template(_.extend(this.model.toJSON(), {
'__': __,
'roles': roles, 'roles': roles,
'pretty_time': moment_time.format(_converse.time_format), 'pretty_time': moment_time.format(_converse.time_format),
'time': moment_time.format(), 'time': moment_time.format(),
...@@ -85554,7 +85559,13 @@ __p += '\n </span>\n <time timestamp="' + ...@@ -85554,7 +85559,13 @@ __p += '\n </span>\n <time timestamp="' +
__e(o.isodate) + __e(o.isodate) +
'" class="chat-msg-time">' + '" class="chat-msg-time">' +
__e(o.pretty_time) + __e(o.pretty_time) +
'</time>\n </span>\n <span class="chat-msg-text"></span>\n <div class="chat-msg-media"></div>\n </div>\n</div>\n'; '</time>\n </span>\n <span class="chat-msg-text"></span>\n <div class="chat-msg-media"></div>\n ';
if (o.edited) { ;
__p += ' <i title="' +
__e(o.__('This message has been edited')) +
'" class="fa fa-edit"></i> ';
} ;
__p += '\n </div>\n</div>\n';
return __p return __p
}; };
...@@ -105,7 +105,11 @@ ...@@ -105,7 +105,11 @@
expect(chatboxview.el.querySelectorAll('.chat-msg').length).toBe(1); expect(chatboxview.el.querySelectorAll('.chat-msg').length).toBe(1);
test_utils.waitUntil(() => chatboxview.el.querySelector('.chat-msg-text').textContent === test_utils.waitUntil(() => chatboxview.el.querySelector('.chat-msg-text').textContent ===
'But soft, what light through yonder window breaks?').then(done); 'But soft, what light through yonder window breaks?').then(() => {
expect(chatboxview.el.querySelectorAll('.chat-msg-content .fa-edit').length).toBe(1);
done();
});
})); }));
describe("when a chatbox is opened for someone who is not in the roster", function () { describe("when a chatbox is opened for someone who is not in the roster", function () {
......
...@@ -662,7 +662,11 @@ ...@@ -662,7 +662,11 @@
message = msgid && chatbox.messages.findWhere({msgid}); message = msgid && chatbox.messages.findWhere({msgid});
if (replace) { if (replace) {
message.save('message', getMessageBody(stanza)); message.save({
'message': getMessageBody(stanza),
'older_versions': (message.get('older_versions') || []).push(message.get('message')),
'edited': true
});
} else if (!message) { } else if (!message) {
// Only create the message when we're sure it's not a duplicate // Only create the message when we're sure it's not a duplicate
chatbox.incrementUnreadMsgCounter(original_stanza); chatbox.incrementUnreadMsgCounter(original_stanza);
......
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
const msg = u.stringToElement(template( const msg = u.stringToElement(template(
_.extend( _.extend(
this.model.toJSON(), { this.model.toJSON(), {
'__': __,
'roles': roles, 'roles': roles,
'pretty_time': moment_time.format(_converse.time_format), 'pretty_time': moment_time.format(_converse.time_format),
'time': moment_time.format(), 'time': moment_time.format(),
......
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
</span> </span>
<span class="chat-msg-text"></span> <span class="chat-msg-text"></span>
<div class="chat-msg-media"></div> <div class="chat-msg-media"></div>
{[ if (o.edited) { ]} <i title="{{{o.__('This message has been edited')}}}" class="fa fa-edit"></i> {[ } ]}
</div> </div>
</div> </div>
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