some changes

This commit is contained in:
Eudes Inácio
2021-12-17 10:14:08 +01:00
parent e1b4ce8113
commit 27d159f917
+21 -17
View File
@@ -334,7 +334,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
console.log('GET FILE WEB', foo )
});
this.storageservice.get('chatmsg').then((msg) => {
this.storageservice.get('chatmsg').then(async (msg) => {
let msgArray =[];
msgArray = msg;
msgArray.filter(data => data._id != this.roomId);
@@ -344,25 +344,29 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
let newmgsArray = [];
msgArray.forEach(async element => {
console.log('GET FILE TRANSFORM',element.file.guid )
if(element.file.guid == msg.file.guid) {
let chatmsg = {
_id: element._id,
attachments: element.attachments,
channels: element.channels,
file: element.file,
mentions: element.mentions,
msg: element.msg,
rid: element.rid,
ts: element.ts,
u: element.u,
_updatedAt: element._updatedAt,
image_url: this.downloadFile
try {
if(element.file.guid == msg.file.guid) {
let chatmsg = {
_id: element._id,
attachments: element.attachments,
channels: element.channels,
file: element.file,
mentions: element.mentions,
msg: element.msg,
rid: element.rid,
ts: element.ts,
u: element.u,
_updatedAt: element._updatedAt,
image_url: this.downloadFile
}
newmgsArray.push(chatmsg)
}
newmgsArray.push(chatmsg)
} catch (error) {
}
});
this.storageservice.store('chatmsg',newmgsArray);
await this.storageservice.remove('chatmsg');
await this.storageservice.store('chatmsg',newmgsArray);
})
}