mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
fix bug
This commit is contained in:
@@ -69,7 +69,7 @@ export class MessageService {
|
||||
|
||||
this.channels = channels || []
|
||||
this.mentions = mentions || []
|
||||
this.msg = msg || ""
|
||||
this.msg = msg || " "
|
||||
this.rid = rid
|
||||
this.ts = ts
|
||||
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.RochetChatUser), username: SessionStore.user.RochetChatUser, _id: ""}
|
||||
|
||||
@@ -257,7 +257,7 @@ export class RoomService {
|
||||
|
||||
// alert('delete')
|
||||
// console.log(args[0], 'receive delete message::()')
|
||||
// this.deleteMessage(args[1]?.method?._id)
|
||||
this.deleteMessage(args[1]?.method?._id)
|
||||
|
||||
} else {
|
||||
// alert('miss')
|
||||
@@ -360,20 +360,22 @@ export class RoomService {
|
||||
* @param id message ID
|
||||
*/
|
||||
async deleteMessage(_id) {
|
||||
alert('delete!!!')
|
||||
|
||||
const id = _id
|
||||
|
||||
for (let i =0; i <= this.messages.length; i++) {
|
||||
|
||||
if(this.messages[i]?._id == id ) {
|
||||
|
||||
// console.log(_id,'==',this.messages[i]?._id, true)
|
||||
|
||||
|
||||
console.log(_id,'==',this.messages[i]?._id, true)
|
||||
this.messages.splice(i, 1)
|
||||
|
||||
if (SessionStore.user.RochetChatUser == this.messages[i].u.username) {
|
||||
const allMemberThatIsOffline = this.getAllMemberThatIsOffline()
|
||||
|
||||
DeleteMessageModel.create({
|
||||
await DeleteMessageModel.create({
|
||||
messageId: this.messages[i]._id,
|
||||
rid: this.messages[i].rid,
|
||||
ts: this.messages[i].ts,
|
||||
@@ -382,7 +384,7 @@ export class RoomService {
|
||||
})
|
||||
}
|
||||
|
||||
this.messages[i].delateDB()
|
||||
await this.messages[i].delateDB()
|
||||
|
||||
//Get previous last message from room
|
||||
const previousLastMessage = this.messages.slice(-1)[0];
|
||||
@@ -420,13 +422,13 @@ export class RoomService {
|
||||
|
||||
async sendDeleteRequest(msgId) {
|
||||
|
||||
const message = this.messages.find((e)=>e._id = msgId)
|
||||
const message = this.messages.find((e)=>e._id == msgId)
|
||||
// await message.delateStatusFalse()
|
||||
|
||||
this.ChatMethodsService.deleteMessage({_id:msgId, msgId:msgId, roomId:message.rid}).subscribe(
|
||||
(response: any) => {
|
||||
|
||||
const message = this.messages.find((e)=>e._id = msgId)
|
||||
const message = this.messages.find((e)=>e._id == msgId)
|
||||
message.delateRequest = true
|
||||
message.save()
|
||||
|
||||
@@ -436,7 +438,7 @@ export class RoomService {
|
||||
if (response.error.error.startsWith('No message found with the id of')) {
|
||||
|
||||
this.deleteMessage(msgId)
|
||||
const message = this.messages.find((e)=>e._id = msgId)
|
||||
const message = this.messages.find((e)=>e._id == msgId)
|
||||
message.delateRequest = true
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user