mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +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 {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</ion-refresher>
|
||||
<div class="messages" #scrollMe>
|
||||
<div class="messages-list-item-wrapper container-width-100"
|
||||
*ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; let last = last">
|
||||
*ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; index as i; let last = last">
|
||||
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.msg !=''">
|
||||
<div class="message-item-options d-flex justify-content-end">
|
||||
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer">
|
||||
@@ -45,7 +45,7 @@
|
||||
</mat-menu>
|
||||
</div>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}} {{msg.delateRequest}}</ion-label>
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div class="d-flex justify-space-between">
|
||||
@@ -75,7 +75,7 @@
|
||||
</mat-menu>
|
||||
</div>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}} {{msg.delateRequest}}</ion-label>
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user