fix typing activity

This commit is contained in:
2026-04-10 18:12:00 -04:00
parent 2bb5d31777
commit eacd25a6ef
3 changed files with 10 additions and 6 deletions
+8 -4
View File
@@ -30,14 +30,16 @@ pub struct VisibleMessageRow {
#[spacetimedb::view(accessor = visible_typing_activity, public)]
pub fn visible_typing_activity(ctx: &ViewContext) -> Vec<TypingActivity> {
let identity = ctx.sender();
let mut results = Vec::new();
let mut results = std::collections::HashMap::new();
// 1. Server channels
for member in ctx.db.server_member().identity().filter(identity) {
if let Some(s) = ctx.db.server().id().find(member.server_id) {
for chan_meta in s.channels {
for activity in ctx.db.typing_activity().channel_id().filter(chan_meta.id) {
results.push(activity);
if activity.typing {
results.insert(activity.identity, activity.clone());
}
}
}
}
@@ -54,11 +56,13 @@ pub fn visible_typing_activity(ctx: &ViewContext) -> Vec<TypingActivity> {
for channel_id in dm_channel_ids {
for activity in ctx.db.typing_activity().channel_id().filter(channel_id) {
results.push(activity);
if activity.typing {
results.insert(activity.identity, activity.clone());
}
}
}
results
results.into_values().collect()
}
#[derive(spacetimedb::SpacetimeType)]
+1 -1
View File
@@ -33,7 +33,7 @@
chat.identity = $spacetime.identity;
webrtc.identity = $spacetime.identity;
}
// Sync voice channel status
const voiceChan = chat.connectedVoiceChannel;
if (voiceChan) {
+1 -1
View File
@@ -593,7 +593,7 @@ export class ChatService {
.filter((ta) => {
const isSameChannel = ta.channelId === activeChannelId;
const isNotMe = myId ? !ta.identity.isEqual(myId) : true;
const currentlyTyping = ta.isTyping;
const currentlyTyping = ta.typing;
return isSameChannel && isNotMe && currentlyTyping;
})