@massalabs/gossip-sdk 0.0.2-dev.20260413074903 → 0.0.2-dev.20260413083255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,6 +19,7 @@ export declare class MessageQueries {
|
|
|
19
19
|
updateById(id: number, data: Partial<MessageInsert>): Promise<void>;
|
|
20
20
|
deleteByOwnerAndContact(ownerUserId: string, contactUserId: string): Promise<void>;
|
|
21
21
|
deleteById(id: number): Promise<void>;
|
|
22
|
+
deleteReactionsForMessage(ownerUserId: string, contactUserId: string, messageIdBase64: string): Promise<void>;
|
|
22
23
|
deleteDeliveredKeepAlive(ownerUserId: string): Promise<void>;
|
|
23
24
|
getOutgoingSentByOwner(ownerUserId: string): Promise<MessageRow[]>;
|
|
24
25
|
getWaitingCount(ownerUserId: string, contactUserId: string): Promise<number>;
|
|
@@ -99,6 +99,11 @@ export class MessageQueries {
|
|
|
99
99
|
.delete(schema.messages)
|
|
100
100
|
.where(eq(schema.messages.id, id));
|
|
101
101
|
}
|
|
102
|
+
async deleteReactionsForMessage(ownerUserId, contactUserId, messageIdBase64) {
|
|
103
|
+
await this.conn.db
|
|
104
|
+
.delete(schema.messages)
|
|
105
|
+
.where(and(eq(schema.messages.ownerUserId, ownerUserId), eq(schema.messages.contactUserId, contactUserId), eq(schema.messages.type, MessageType.REACTION), sql `json_extract(${schema.messages.reactionOf}, '$.originalMsgId') = ${messageIdBase64}`));
|
|
106
|
+
}
|
|
102
107
|
async deleteDeliveredKeepAlive(ownerUserId) {
|
|
103
108
|
await this.conn.db
|
|
104
109
|
.delete(schema.messages)
|
package/dist/services/message.js
CHANGED
|
@@ -434,9 +434,14 @@ export class MessageService {
|
|
|
434
434
|
content: '[Message deleted]',
|
|
435
435
|
type: MessageType.DELETED,
|
|
436
436
|
});
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
437
|
+
const targetId = target.id;
|
|
438
|
+
const deleteOriginalMsgId = message.deleteOf.originalMsgId;
|
|
439
|
+
await this.queries.conn.withTransaction(async () => {
|
|
440
|
+
await this.queries.messages.updateById(targetId, {
|
|
441
|
+
content: '[Message deleted]',
|
|
442
|
+
type: MessageType.DELETED,
|
|
443
|
+
});
|
|
444
|
+
await this.queries.messages.deleteReactionsForMessage(ownerUserId, target.contactUserId, encodeToBase64(deleteOriginalMsgId));
|
|
440
445
|
});
|
|
441
446
|
}
|
|
442
447
|
continue;
|
|
@@ -1396,9 +1401,13 @@ export class MessageService {
|
|
|
1396
1401
|
});
|
|
1397
1402
|
}
|
|
1398
1403
|
try {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1404
|
+
const messageId = row.messageId;
|
|
1405
|
+
await this.queries.conn.withTransaction(async () => {
|
|
1406
|
+
await this.queries.messages.updateById(id, {
|
|
1407
|
+
content: '[Message deleted]',
|
|
1408
|
+
type: MessageType.DELETED,
|
|
1409
|
+
});
|
|
1410
|
+
await this.queries.messages.deleteReactionsForMessage(ownerUserId, row.contactUserId, encodeToBase64(messageId));
|
|
1402
1411
|
});
|
|
1403
1412
|
const controlMessage = {
|
|
1404
1413
|
ownerUserId,
|
package/package.json
CHANGED