File tree 1 file changed +9
-11
lines changed 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -145,11 +145,11 @@ export abstract class AbstractOfflineDB implements OfflineDBApi {
145
145
return await this . client . _deleteMessage ( ...task . payload ) ;
146
146
}
147
147
148
- const channel = this . client . channel ( task . channelType , task . channelId ) ;
149
-
150
148
const { channelType, channelId } = task ;
151
149
152
150
if ( channelType && channelId ) {
151
+ const channel = this . client . channel ( channelType , channelId ) ;
152
+
153
153
if ( task . type === 'send-reaction' ) {
154
154
return await channel . _sendReaction ( ...task . payload ) ;
155
155
}
@@ -212,27 +212,25 @@ export type PendingTaskTypes = {
212
212
sendReaction : 'send-reaction' ;
213
213
} ;
214
214
215
- export type PendingTaskChannelCommonType = {
216
- channelId : string ;
217
- channelType : string ;
218
- } ;
219
-
215
+ // TODO: Please rethink the definition of PendingTasks as it seems awkward
220
216
export type PendingTask = {
217
+ channelId ?: string ;
218
+ channelType ?: string ;
221
219
messageId : string ;
222
220
id ?: number ;
223
221
} & (
224
- | ( PendingTaskChannelCommonType & {
222
+ | {
225
223
payload : Parameters < Channel [ 'sendReaction' ] > ;
226
224
type : PendingTaskTypes [ 'sendReaction' ] ;
227
- } )
225
+ }
228
226
| {
229
227
payload : Parameters < StreamChat [ 'deleteMessage' ] > ;
230
228
type : PendingTaskTypes [ 'deleteMessage' ] ;
231
229
}
232
- | ( PendingTaskChannelCommonType & {
230
+ | {
233
231
payload : Parameters < Channel [ 'deleteReaction' ] > ;
234
232
type : PendingTaskTypes [ 'deleteReaction' ] ;
235
- } )
233
+ }
236
234
) ;
237
235
238
236
/**
You can’t perform that action at this time.
0 commit comments