Skip to content

Commit 058260a

Browse files
committed
When purging while banning a user, also remove their emoji reactions.
This expands on oxen-io#2653 and ensures that when a user is banned from a room or an entire server, and **Delete All** has been selected, not just his messages but also his emoji reactions will be removed. This pull-request depends on oxen-io/session-pysogs#169. Verified working on `sog.caliban.org`.
1 parent 4891c24 commit 058260a

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

ts/session/apis/open_group_api/sogsv3/sogsV3BanUnban.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export const sogsV3BanUser = async (
2525
type: 'deleteAllPosts',
2626
deleteAllPosts: { sessionId: userToBan.key, roomId: roomInfos.roomId },
2727
});
28+
sequence.push({
29+
type: 'deleteAllReactions',
30+
deleteAllReactions: { sessionId: userToBan.key, roomId: roomInfos.roomId },
31+
});
2832
}
2933

3034
const batchSendResponse = await sogsBatchSend(
@@ -83,6 +87,10 @@ export const sogsV3ServerBanUser = async (
8387
type: 'deleteAllUserPosts',
8488
deleteAllUserPosts: { sessionId: userToBan.key },
8589
});
90+
sequence.push({
91+
type: 'deleteAllUserReactions',
92+
deleteAllUserReactions: { sessionId: userToBan.key },
93+
});
8694
}
8795

8896
const batchSendResponse = await sogsBatchSend(

ts/session/apis/open_group_api/sogsv3/sogsV3BatchPoll.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,21 @@ export type SubRequestDeleteAllUserServerPostsType = {
198198
};
199199
};
200200

201+
export type SubRequestDeleteAllUserReactionsType = {
202+
type: 'deleteAllReactions';
203+
deleteAllReactions: {
204+
sessionId: string; // can be blinded id or not
205+
roomId: string;
206+
};
207+
};
208+
209+
export type SubRequestDeleteAllUserServerReactionsType = {
210+
type: 'deleteAllUserReactions';
211+
deleteAllUserReactions: {
212+
sessionId: string; // can be blinded id or not
213+
};
214+
};
215+
201216
export type SubRequestUpdateRoomType = {
202217
type: 'updateRoom';
203218
updateRoom: {
@@ -226,7 +241,9 @@ export type OpenGroupBatchRow =
226241
| SubRequestAddRemoveModeratorType
227242
| SubRequestBanUnbanUserType
228243
| SubRequestDeleteAllUserPostsType
244+
| SubRequestDeleteAllUserReactionsType
229245
| SubRequestDeleteAllUserServerPostsType
246+
| SubRequestDeleteAllUserServerReactionsType
230247
| SubRequestUpdateRoomType
231248
| SubRequestDeleteReactionType;
232249

@@ -343,7 +360,17 @@ const makeBatchRequestPayload = (
343360
method: 'DELETE',
344361
path: `/rooms/all/${options.deleteAllUserPosts.sessionId}`,
345362
};
346-
case 'updateRoom':
363+
case 'deleteAllReactions':
364+
return {
365+
method: 'DELETE',
366+
path: `/room/${options.deleteAllReactions.roomId}/all/reactions/${options.deleteAllReactions.sessionId}`,
367+
};
368+
case 'deleteAllUserReactions':
369+
return {
370+
method: 'DELETE',
371+
path: `/rooms/all/reactions/${options.deleteAllUserReactions.sessionId}`,
372+
};
373+
case 'updateRoom':
347374
return {
348375
method: 'PUT',
349376
path: `/room/${options.updateRoom.roomId}`,

0 commit comments

Comments
 (0)