|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import AbortController from 'abort-controller';
|
|
|
|
|
import { getConversationController } from '../../../conversations';
|
|
|
|
|
import { OpenGroupRequestCommonType } from '../opengroupV2/ApiUtil';
|
|
|
|
|
import { getOpenGroupV2ConversationId } from '../utils/OpenGroupUtils';
|
|
|
|
|
import {
|
|
|
|
@ -7,7 +8,6 @@ import {
|
|
|
|
|
OpenGroupBatchRow,
|
|
|
|
|
sogsBatchSend,
|
|
|
|
|
} from './sogsV3BatchPoll';
|
|
|
|
|
import { getConversationController } from '../../../conversations';
|
|
|
|
|
|
|
|
|
|
type OpenGroupClearInboxResponse = {
|
|
|
|
|
deleted: number;
|
|
|
|
@ -21,7 +21,7 @@ export const clearInbox = async (roomInfos: OpenGroupRequestCommonType): Promise
|
|
|
|
|
|
|
|
|
|
if (!conversation) {
|
|
|
|
|
throw new Error(`clearInbox Matching conversation not found in db ${conversationId}`);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
const options: Array<OpenGroupBatchRow> = [
|
|
|
|
|
{
|
|
|
|
|
type: 'inbox',
|
|
|
|
@ -43,8 +43,7 @@ export const clearInbox = async (roomInfos: OpenGroupRequestCommonType): Promise
|
|
|
|
|
throw new Error(`Could not clearInbox, res is invalid for ${conversationId}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const rawMessage =
|
|
|
|
|
(result.body && (result.body[0].body as OpenGroupClearInboxResponse)) || null;
|
|
|
|
|
const rawMessage = (result.body && (result.body[0].body as OpenGroupClearInboxResponse)) || null;
|
|
|
|
|
if (!rawMessage) {
|
|
|
|
|
throw new Error(`clearInbox parsing failed for ${conversationId}`);
|
|
|
|
|
}
|
|
|
|
@ -57,7 +56,6 @@ export const clearInbox = async (roomInfos: OpenGroupRequestCommonType): Promise
|
|
|
|
|
} catch (e) {
|
|
|
|
|
window?.log?.error(`clearInbox Can't decode JSON body for ${conversationId}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!success) {
|
|
|
|
|
window.log.info(`clearInbox message deletion failed for ${conversationId}`);
|
|
|
|
|