Search code examples
getstream-io

Only show notification activities in the recipient's feed


I have a simple notification use-case: Coaches need to approve their user's weekly check-in logs. When the log is approved, the user gets a notification. 

The issue is that I don't understand how to add the activity without adding it to the coach's notification feed also by targeting the notification with the TO field. If I do that, then I need to exclude the copied activity from the coach's feed, because the coach doesn't need a notification of the activity they just took. Also, I then have an issue with the unread counts, and I would either need to automatically mark notifications that one user sends to another as read so that it doesn't distort the unread count for the sender. 

Anyway, the question I have is am I setting this up correctly? Is there an easier way to achieve the result I want?


Solution

  • If the feed ID and activity actor are the same, you can use discard rules to achieve this.

    For instance:

    If the notification feed is called notification:$choach-id and the activity verb is set to $coach-id then discard rules will make this work.

    More information about this is available https://getstream.io/docs/discard_rules/