Skip to content

Commit 4503fd4

Browse files
committed
chore: cleanupo
1 parent 477553d commit 4503fd4

File tree

2 files changed

+34
-35
lines changed

2 files changed

+34
-35
lines changed

need.tsx

Whitespace-only changes.

package/src/components/Chat/hooks/handleEventToSyncDB.ts

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { updateMessage } from '../../../store/apis/updateMessage';
77
import { upsertChannelData } from '../../../store/apis/upsertChannelData';
88
import { upsertChannelDataFromChannel } from '../../../store/apis/upsertChannelDataFromChannel';
99
import { upsertMembers } from '../../../store/apis/upsertMembers';
10-
import { upsertMessages } from '../../../store/apis/upsertMessages';
1110
import { upsertReads } from '../../../store/apis/upsertReads';
1211
import { createSelectQuery } from '../../../store/sqlite-utils/createSelectQuery';
1312
import { SqliteClient } from '../../../store/SqliteClient';
@@ -112,40 +111,40 @@ export const handleEventToSyncDB = async (event: Event, client: StreamChat, flus
112111
}
113112
}
114113

115-
if (type === 'message.new') {
116-
const { cid, message, user } = event;
117-
118-
if (message && (!message.parent_id || message.show_in_channel)) {
119-
return await queriesWithChannelGuard(async (flushOverride) => {
120-
let queries = await upsertMessages({
121-
flush: flushOverride,
122-
messages: [message],
123-
});
124-
if (cid && client.user && client.user.id !== user?.id) {
125-
const userId = client.user.id;
126-
const channel = client.activeChannels[cid];
127-
if (channel) {
128-
const ownReads = channel.state.read[userId];
129-
const unreadCount = channel.countUnread();
130-
const upsertReadsQueries = await upsertReads({
131-
cid,
132-
flush: flushOverride,
133-
reads: [
134-
{
135-
last_read: ownReads.last_read.toString() as string,
136-
last_read_message_id: ownReads.last_read_message_id,
137-
unread_messages: unreadCount,
138-
user: client.user,
139-
},
140-
],
141-
});
142-
queries = [...queries, ...upsertReadsQueries];
143-
}
144-
}
145-
return queries;
146-
});
147-
}
148-
}
114+
// if (type === 'message.new') {
115+
// const { cid, message, user } = event;
116+
//
117+
// if (message && (!message.parent_id || message.show_in_channel)) {
118+
// return await queriesWithChannelGuard(async (flushOverride) => {
119+
// let queries = await upsertMessages({
120+
// flush: flushOverride,
121+
// messages: [message],
122+
// });
123+
// if (cid && client.user && client.user.id !== user?.id) {
124+
// const userId = client.user.id;
125+
// const channel = client.activeChannels[cid];
126+
// if (channel) {
127+
// const ownReads = channel.state.read[userId];
128+
// const unreadCount = channel.countUnread();
129+
// const upsertReadsQueries = await upsertReads({
130+
// cid,
131+
// flush: flushOverride,
132+
// reads: [
133+
// {
134+
// last_read: ownReads.last_read.toString() as string,
135+
// last_read_message_id: ownReads.last_read_message_id,
136+
// unread_messages: unreadCount,
137+
// user: client.user,
138+
// },
139+
// ],
140+
// });
141+
// queries = [...queries, ...upsertReadsQueries];
142+
// }
143+
// }
144+
// return queries;
145+
// });
146+
// }
147+
// }
149148

150149
if (type === 'message.updated' || type === 'message.deleted') {
151150
const message = event.message;

0 commit comments

Comments
 (0)