@@ -72,12 +72,10 @@ pub async fn query_mentions(
7272 . push_bind ( serde_json:: json!( [ [ "p" , pubkey_hex] ] ) . to_string ( ) )
7373 . push ( ", '$')" ) ;
7474
75- // Kinds: stream messages, stream replies, forum posts, forum comments
7675 qb. push ( format ! (
7776 " AND kind IN ({KIND_STREAM_MESSAGE}, {KIND_STREAM_MESSAGE_V2}, {KIND_FORUM_POST}, {KIND_FORUM_COMMENT})"
7877 ) ) ;
7978
80- // Channel access filter
8179 if !accessible_channel_ids. is_empty ( ) {
8280 qb. push ( " AND channel_id IN (" ) ;
8381 let mut sep = qb. separated ( ", " ) ;
@@ -130,16 +128,12 @@ pub async fn query_needs_action(
130128 " AND kind IN ({KIND_WORKFLOW_APPROVAL_REQUESTED}, {KIND_STREAM_REMINDER})"
131129 ) ) ;
132130
133- // Tag filter: must be tagged to this user.
134131 // Wrap in outer array so MySQL checks for exact sub-array membership — see
135132 // query_mentions for a full explanation of the JSON_CONTAINS semantics.
136133 qb. push ( " AND JSON_CONTAINS(tags, " )
137134 . push_bind ( serde_json:: json!( [ [ "p" , pubkey_hex] ] ) . to_string ( ) )
138135 . push ( ", '$')" ) ;
139136
140- // Access control: only return events from channels the user can access.
141- // Identical pattern to query_mentions — prevents leaking events from
142- // channels the user has been removed from.
143137 if !accessible_channel_ids. is_empty ( ) {
144138 qb. push ( " AND channel_id IN (" ) ;
145139 let mut sep = qb. separated ( ", " ) ;
@@ -183,8 +177,6 @@ pub async fn query_activity(
183177 FROM events WHERE 1=1",
184178 ) ;
185179
186- // Stream messages, forum posts, agent job events.
187- // KIND_JOB_REQUEST = agent job requested, KIND_JOB_PROGRESS = in-flight progress update, KIND_JOB_RESULT = completed result.
188180 qb. push ( format ! (
189181 " AND kind IN ({KIND_STREAM_MESSAGE}, {KIND_STREAM_MESSAGE_V2}, {KIND_FORUM_POST}, {KIND_JOB_REQUEST}, {KIND_JOB_PROGRESS}, {KIND_JOB_RESULT})"
190182 ) ) ;
@@ -233,7 +225,6 @@ mod tests {
233225
234226 #[ test]
235227 fn pubkey_hex_encoding_32_byte_key ( ) {
236- // Simulate a full 32-byte Nostr pubkey.
237228 let pubkey_bytes: Vec < u8 > = ( 0u8 ..32 ) . collect ( ) ;
238229 let hex = hex:: encode ( & pubkey_bytes) ;
239230 assert_eq ! ( hex. len( ) , 64 ) ;
@@ -308,8 +299,6 @@ mod tests {
308299 use sprout_core:: kind:: {
309300 KIND_FORUM_COMMENT , KIND_FORUM_POST , KIND_STREAM_MESSAGE , KIND_STREAM_MESSAGE_V2 ,
310301 } ;
311- // query_mentions filters for: KIND_STREAM_MESSAGE, KIND_STREAM_MESSAGE_V2,
312- // KIND_FORUM_POST, KIND_FORUM_COMMENT
313302 let mention_kinds: & [ u32 ] = & [
314303 KIND_STREAM_MESSAGE ,
315304 KIND_STREAM_MESSAGE_V2 ,
@@ -338,7 +327,6 @@ mod tests {
338327 #[ test]
339328 fn needs_action_query_includes_approval_and_reminder_kinds ( ) {
340329 use sprout_core:: kind:: { KIND_STREAM_REMINDER , KIND_WORKFLOW_APPROVAL_REQUESTED } ;
341- // query_needs_action filters for: KIND_WORKFLOW_APPROVAL_REQUESTED, KIND_STREAM_REMINDER
342330 let needs_action_kinds: & [ u32 ] = & [ KIND_WORKFLOW_APPROVAL_REQUESTED , KIND_STREAM_REMINDER ] ;
343331
344332 assert ! (
@@ -357,8 +345,6 @@ mod tests {
357345 KIND_FORUM_POST , KIND_JOB_PROGRESS , KIND_JOB_REQUEST , KIND_JOB_RESULT ,
358346 KIND_STREAM_MESSAGE , KIND_STREAM_MESSAGE_V2 ,
359347 } ;
360- // query_activity filters for: KIND_STREAM_MESSAGE, KIND_STREAM_MESSAGE_V2,
361- // KIND_FORUM_POST, KIND_JOB_REQUEST, KIND_JOB_PROGRESS, KIND_JOB_RESULT
362348 let activity_kinds: & [ u32 ] = & [
363349 KIND_STREAM_MESSAGE ,
364350 KIND_STREAM_MESSAGE_V2 ,
@@ -423,7 +409,6 @@ mod tests {
423409 KIND_STREAM_MESSAGE , KIND_STREAM_MESSAGE_V2 , KIND_STREAM_REMINDER ,
424410 KIND_WORKFLOW_APPROVAL_REQUESTED ,
425411 } ;
426- // The two queries serve different purposes — their kind sets should not overlap.
427412 let needs_action_kinds: & [ u32 ] = & [ KIND_WORKFLOW_APPROVAL_REQUESTED , KIND_STREAM_REMINDER ] ;
428413 let activity_kinds: & [ u32 ] = & [
429414 KIND_STREAM_MESSAGE ,
0 commit comments