Skip to content

Commit 49e37d1

Browse files
refactor: drop un-used pending task type
1 parent 83278b6 commit 49e37d1

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

package/src/store/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export type PreparedQueries = [string] | [string, Array<any>];
1616
export type PendingTaskTypes = {
1717
deleteMessage: 'delete-message';
1818
deleteReaction: 'delete-reaction';
19-
sendMessage: 'send-message';
2019
sendReaction: 'send-reaction';
2120
};
2221

@@ -30,10 +29,6 @@ export type PendingTask = {
3029
payload: Parameters<Channel['sendReaction']>;
3130
type: PendingTaskTypes['sendReaction'];
3231
}
33-
| {
34-
payload: Parameters<Channel['sendMessage']>;
35-
type: PendingTaskTypes['sendMessage'];
36-
}
3732
| {
3833
payload: Parameters<StreamChat['deleteMessage']>;
3934
type: PendingTaskTypes['deleteMessage'];

package/src/utils/pendingTaskUtils.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,6 @@ const executeTask = async <
5959
return await client.deleteMessage(...task.payload);
6060
}
6161

62-
if (task.type === 'send-message') {
63-
const message = task.payload[0];
64-
if (message.attachments?.length) {
65-
for (let i = 0; i < message.attachments?.length; i++) {
66-
const attachment = message.attachments[i];
67-
if (attachment.type === 'image' && attachment.image_url) {
68-
const response = await channel.sendImage(attachment.image_url);
69-
attachment.image_url = response.file;
70-
}
71-
72-
if (
73-
(attachment.type === 'file' ||
74-
attachment.type === 'audio' ||
75-
attachment.type === 'video') &&
76-
attachment.asset_url
77-
) {
78-
const response = await channel.sendFile(attachment.asset_url);
79-
attachment.asset_url = response.file;
80-
}
81-
}
82-
}
83-
84-
return await channel.sendMessage(...task.payload);
85-
}
86-
8762
throw new Error('Invalid task type');
8863
};
8964

0 commit comments

Comments
 (0)