How to remove activity from multiple feeds? - getstream-io

I'm using notification feeds where users get a notification when other users add replies into a forum thread they are part of.
I'd like to know how I can remove activities from all feeds when the reply is deleted?
I can't seem to find any information about that. The examples show how I can remove an activity from one users feed. But I don't necessarily know all the users that might have the activity on their notifications feed.
Or is there a way to get a list of notification feeds that contain activities with a foreign id?

When you delete an activity from a feed, a delete is propagated to every feed that received that activity via follow relationship or to field. In your example, if you delete the activity from the "origin" feed you should be OK. If that's not the case you should probably expand your question with more detail.
Since you mentioned it: deletes by foreign_id allow you to delete all activities from one feed that share the same foreign_id value. For example: say that you have many activities in a feed with foreign_id "post:42" and you want to delete them all in once, you can perform a delete on foreign_id="post:42".

Related

What is the best way to add a user feed to his own timeline?

I would like to build an Instagram-like social app, where on the user timeline, you also have his own activities displayed. My first thought was to follow his own user feed but from what I read in this blog post: https://getstream.io/blog/best-practices-for-instagram-style-feeds/
We recommend blocking a user's timeline feed from following their own user feed
Can someone explain why it would be a bad practice ? How could I implement my use case if that is the case ?
Thanks !
Looking at this myself. I think the logic they describe is incorrect. The full statement in context make a little more sense in terms of what I think they mean.
We recommend blocking a user's timeline feed from following their own
user feed, and also blocking users from seeing/following another
user's timeline feed.
The first part of the sentence I believe is backwards. What I think it should says is that the "user" feed should be blocked from following the "timeline" feed. The user feed should just contain actions that the user performed, so it shouldn't contain data from the timeline feed. But if you want the user's activities to appear in the timeline feed than it seems to me that you should definetly make the user's timeline feed follow thier user feed, and prevent the user's timeline feed from unfollowing their own user feed.
The second part that says you should block users from following another user's timeline feed. I believe this is correct because the timeline feed is a series of peronalised items for an individual user. It doesn't make sense to follow another user's timeline feed.
This is how I have implemented my logic and it seems to be working so far, but if I come across any issues with it I'll come back here and update this answer.

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?
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/

How to setup GetStream for corporate intranet?

I'm looking to add a "company feed" to a corporate intranet SaaS application. More or less a timeline of posts very similar to facebook.
1) I think the Flat feed type is what I'd want for that but not sure.
2) I don't want users to have to "follow" one another. If you post on the company feed, everyone in the company should probably see it. How would you set this up on GetStream?
1) Yes, a flat feed is what you'd want.
2) If the users don't follow each other, everyone in the company posts to the same feed, and the same feed is shown to everyone in the company, then the best option is probably to set up a single feed group (timeline, maybe), with one feed in it (timeline:company1234) that everyone posts to and reads from.
Then, whenever a user posts on the company's feed, you'll add an activity to the timeline:company1234 feed, and whenever someone needs to read the feed, you'll retrieve the activities from the timeline:company1234 feed.

Retrieving a post's likes

In my application, I have a 'user_post' feed which is responsible for storing the posts of a user. I would like a way to retrieve the likes of each individual post.
If I added a feed called 'post_like' I could store the likes of each post in their own feed. Is this approach efficient?
I'd suggest using a notification feed for that, not a flat feed. Set the verb to 'like' or whatever is appropriate for your app, and the actor is the user who 'liked' the original activity. When you call the user's notification feed, you'll get a list of all users who liked it.
If you store the likes in your own database and send the like to us with a foreign ID then you can always remove the activity later if they 'un-like' something afterward.

getstream.io disable the fanout notification when a feed follows another

I have this scenario:
A user follows a feed and they receive all of that feed's current posts as new posts (via realtime notification.. likely caused by a fanout)
While its accurate that all that feed's items are new to the follower, I'd like to stop the notification from appearing..Is it possible to disable the fanout notification when a feed follows another?
We don't currently have a way to suppress realtime notifications upon follow. The only way I think you could accomplish this would be for User A to follow User B without copying any old items, but then User A would only see new activities going forward.
I'll mention this to the team as a feature request.

Resources