nickname
This commit is contained in:
@@ -64,6 +64,7 @@ export const getTyping = query({
|
||||
v.object({
|
||||
userId: v.id("userProfiles"),
|
||||
username: v.string(),
|
||||
displayName: v.union(v.string(), v.null()),
|
||||
})
|
||||
),
|
||||
handler: async (ctx, args) => {
|
||||
@@ -73,9 +74,17 @@ export const getTyping = query({
|
||||
.withIndex("by_channel", (q) => q.eq("channelId", args.channelId))
|
||||
.collect();
|
||||
|
||||
return indicators
|
||||
.filter((t) => t.expiresAt > now)
|
||||
.map((t) => ({ userId: t.userId, username: t.username }));
|
||||
const active = indicators.filter((t) => t.expiresAt > now);
|
||||
const results = [];
|
||||
for (const t of active) {
|
||||
const user = await ctx.db.get(t.userId);
|
||||
results.push({
|
||||
userId: t.userId,
|
||||
username: t.username,
|
||||
displayName: user?.displayName || null,
|
||||
});
|
||||
}
|
||||
return results;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user