mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
need to change branch
This commit is contained in:
@@ -5,7 +5,6 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { capitalizeTxt } from 'src/plugin/text'
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { showDateDuration } from 'src/plugin/showDateDuration';
|
||||
import { ChatStorageService } from './chat-storage.service'
|
||||
import { ChatMethodsService } from './chat-methods.service'
|
||||
@@ -52,6 +51,8 @@ export class MessageService {
|
||||
addToDb = false
|
||||
|
||||
messageSend = false
|
||||
delate = false
|
||||
delateRequest = false
|
||||
|
||||
constructor(private storage: Storage,
|
||||
private NfService: NfService,
|
||||
@@ -61,7 +62,7 @@ export class MessageService {
|
||||
private AESEncrypt: AESEncrypt) {
|
||||
}
|
||||
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = []}:Message) {
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, }:Message) {
|
||||
|
||||
this.channels = channels || []
|
||||
this.mentions = mentions || []
|
||||
@@ -77,6 +78,8 @@ export class MessageService {
|
||||
this.temporaryData = temporaryData
|
||||
this.localReference = localReference || null
|
||||
this.id = id
|
||||
this.delate = delate
|
||||
this.delateRequest = delateRequest
|
||||
|
||||
this.viewed = [...new Set([...viewed,...this.viewed])];
|
||||
this.received = [...new Set([...received,...this.received])];
|
||||
@@ -231,15 +234,12 @@ export class MessageService {
|
||||
this.duration = showDateDuration(date || this._updatedAt);
|
||||
}
|
||||
|
||||
private messageReceptor() {
|
||||
return this.u.username != SessionStore.user.RochetChatUser
|
||||
|
||||
async deleteFromDB() {
|
||||
this.delate = true
|
||||
this.save()
|
||||
}
|
||||
|
||||
async delete() {
|
||||
|
||||
const message = await MessageModel.get({_id: this._id})
|
||||
await message.delete()
|
||||
}
|
||||
|
||||
isSenderIsNotMe(ChatMessage) {
|
||||
return SessionStore.user.RochetChatUser != ChatMessage.u.username
|
||||
@@ -267,7 +267,8 @@ export class MessageService {
|
||||
received: this.received,
|
||||
localReference: this.localReference,
|
||||
attachments: this.attachments,
|
||||
file: this.file
|
||||
file: this.file,
|
||||
delate: this.delate
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +279,6 @@ export class MessageService {
|
||||
|
||||
delete message.id
|
||||
const createdMessage = await MessageModel.create(message)
|
||||
console.log('done add to db')
|
||||
|
||||
this.id = createdMessage.id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user