fix typing activity
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user