remove deleted objects from outbox

This commit is contained in:
marlon-erler
2024-07-11 02:15:02 +02:00
parent fbed8f8780
commit cf935b400a
3 changed files with 13 additions and 5 deletions
+10 -4
View File
@@ -595,16 +595,22 @@
const messageString = JSON.stringify(chatMessage); const messageString = JSON.stringify(chatMessage);
UDN.sendMessage(chatMessage.channel, messageString); UDN.sendMessage(chatMessage.channel, messageString);
this.outbox.remove(chatMessage); this.outbox.remove(chatMessage);
if (chatMessage.messageObject)
this.objectOutbox.remove(chatMessage.messageObject.id);
}; };
// objects // objects
async addObjectAndSend(object) { addObjectAndSend(object) {
this.objects.set(object.id, object); this.objects.set(object.id, object);
await this.sendObject(object); this.sendObject(object);
} }
async sendObject(object) { sendObject(object) {
this.objectOutbox.set(object.id, object); this.objectOutbox.set(object.id, object);
this.sendMessagesInOutbox(); this.sendMessagesInOutbox();
} }
deleteObject(object) {
this.objects.remove(object.id);
this.objectOutbox.remove(object.id);
}
// channel // channel
setChannel = () => { setChannel = () => {
if (this.cannotSetChannel.value == true) return; if (this.cannotSetChannel.value == true) return;
@@ -1133,7 +1139,7 @@
closeModal(); closeModal();
} }
function deleteAndClose() { function deleteAndClose() {
chat.objects.remove(object.id); chat.deleteObject(object);
closeModal(); closeModal();
} }
const editingTitle = new State(object.title); const editingTitle = new State(object.title);
+2
View File
@@ -267,6 +267,8 @@ export class Chat {
UDN.sendMessage(chatMessage.channel, messageString); UDN.sendMessage(chatMessage.channel, messageString);
this.outbox.remove(chatMessage); this.outbox.remove(chatMessage);
if (chatMessage.messageObject)
this.objectOutbox.remove(chatMessage.messageObject.id);
}; };
// objects // objects
+1 -1
View File
@@ -21,7 +21,7 @@ export function ItemDetailModal(
} }
function deleteAndClose() { function deleteAndClose() {
chat.objects.remove(object.id); chat.deleteObject(object);
closeModal(); closeModal();
} }