Merge pull request #1716 from dpalou/MOBILE-2795

MOBILE-2795 messages: Fix videos refreshed when VideoJS is on
main
Juan Leyva 2019-01-10 11:10:19 +01:00 committed by GitHub
commit 8e8d770cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);