@@ -137,6 +137,8 @@ export type DeleteMemberType = {
137
137
138
138
export type DeleteMessageType = { id : string ; flush ?: boolean } ;
139
139
140
+ export type DeleteChannelType = { cid : string ; flush ?: boolean } ;
141
+
140
142
export type ChannelExistsType = { cid : string } ;
141
143
142
144
export type ExecuteBatchQueriesType = PreparedBatchQueries [ ] ;
@@ -172,6 +174,7 @@ export interface OfflineDBApi {
172
174
deletePendingTask : ( options : DeletePendingTaskType ) => Promise < ExecuteBatchQueriesType > ;
173
175
deleteReaction : ( options : DeleteReactionType ) => Promise < ExecuteBatchQueriesType > ;
174
176
deleteMember : ( options : DeleteMemberType ) => Promise < ExecuteBatchQueriesType > ;
177
+ deleteChannel : ( options : DeleteChannelType ) => Promise < ExecuteBatchQueriesType > ;
175
178
hardDeleteMessage : ( options : DeleteMessageType ) => Promise < ExecuteBatchQueriesType > ;
176
179
softDeleteMessage : ( options : DeleteMessageType ) => Promise < ExecuteBatchQueriesType > ;
177
180
resetDB : ( ) => Promise < unknown > ;
@@ -235,6 +238,8 @@ export abstract class AbstractOfflineDB implements OfflineDBApi {
235
238
236
239
abstract deleteMember : OfflineDBApi [ 'deleteMember' ] ;
237
240
241
+ abstract deleteChannel : OfflineDBApi [ 'deleteChannel' ] ;
242
+
238
243
abstract hardDeleteMessage : OfflineDBApi [ 'hardDeleteMessage' ] ;
239
244
240
245
abstract softDeleteMessage : OfflineDBApi [ 'softDeleteMessage' ] ;
@@ -253,7 +258,7 @@ export abstract class AbstractOfflineDB implements OfflineDBApi {
253
258
if ( ! cid ) {
254
259
return await createQueries ( flush ) ;
255
260
}
256
- const channelExists = this . channelExists ( { cid } ) ;
261
+ const channelExists = await this . channelExists ( { cid } ) ;
257
262
// a channel is not present in the db, we first fetch the channel data from the channel object.
258
263
// this can happen for example when a message.new event is received for a channel that is not in the db due to a channel being hidden.
259
264
if ( ! channelExists ) {
0 commit comments