MOBILE-2795 messages: Fix videos refreshed when VideoJS is on

main
Dani Palou 2019-01-10 10:25:47 +01:00
parent 32d649b6e3
commit 144163ced7
1 changed files with 5 additions and 2 deletions

View File

@ -132,8 +132,11 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
* @param {boolean} [keep=true] If set the keep flag or not. * @param {boolean} [keep=true] If set the keep flag or not.
*/ */
protected addMessage(message: any, keep: boolean = true): void { protected addMessage(message: any, keep: boolean = true): void {
// Use text instead of message ID because ID changes when a message is read. /* Create a hash to identify the message. The text of online messages isn't reliable because it can have random data
message.hash = Md5.hashAsciiStr(message.text || '') + '#' + message.timecreated + '#' + message.useridfrom; like VideoJS ID. Try to use id and fallback to text for offline messages. */
message.hash = Md5.hashAsciiStr(String(message.id || message.text || '')) + '#' + message.timecreated + '#' +
message.useridfrom;
if (typeof this.keepMessageMap[message.hash] === 'undefined') { if (typeof this.keepMessageMap[message.hash] === 'undefined') {
// Message not added to the list. Add it now. // Message not added to the list. Add it now.
this.messages.push(message); this.messages.push(message);