Using GetStream, can I show a user's actions on his follower's timeline but not on his profile feed? - getstream-io

I am building a web app where users can post articles. They can also comment, like and share posted articles. Users can follow other users so that they see their activities on their timeline feed.
On their timeline feed, they see the activities of all the users they follow. And just like Facebook, they can access a user's profile page where they see the user's "profile feed". On this feed, they only see this specific user's recent activities.
On a "profile feed", I only want to show some specific actions like "Jack posted a new article" or "Jack shared this article". I don't want to show activities like "Jack commented this article" or "Jack liked this article". But I wan't to show all of these activities on the timeline feeds.
After reading the whole docs, I don't see how I could do this. For the timeline feed, I'm good. For the "profile feed", I think I would need to read the user feed, but this feed will include all of the user's activities including comments, likes, etc. Is there a way to read a feed and ask for only specific verbs?

This is how I handled this situation :
Have two user feed groups. One user_profile_actions for actions that belong on a user's profile and one user_other_actions for other actions. This way, when I want to display the user's profile, I read the user_profile_actions feed. And when someone decides to follow a user, I will make his timeline_aggregated feed follows both user feeds this way:
$follows = [
['source' => 'timeline_aggregated:peter', 'target' => 'user_profile_actions:jack'],
['source' => 'timeline_aggregated:peter', 'target' => 'user_other_actions:jack'],
];
$batcher->followMany($follows);

Related

is this a good gherkin syntax

This is my first time writing a gherkin scenario, and I'm wondering if my writing is appropriate for gherkin or not? The example is for getting to the dashboard. Here is my example:
Feature: [The dashboard of the platform]
Scenario: [getting into the dashboard]
Given user logged in
When user clicks on the dashboard
Then user get into the dashboard
When user clicks on my courses
Then user sees the courses he got enrolled
When user clicks on my marks
Then user sees his marks
When user clicks on my educational bags
Then user sees his videos and assignments
When user clicks on my certificates
Then user sees his certificates
When user clicks on student record
Then he user sees his record
When user clicks on sign out
Then user logs out
The art of writing good Gherkin is to focus on WHAT you are doing and avoid anything to do with HOW you are doing something. So with your scenario you need to think about WHAT you are doing.
Each scenario should deal with only one thing. So you should have only one WHEN per scenario.
Scenario: View my dashboard
Scenario: View my courses
Scenario: View my marks
Scenario: View my bags
...
Each scenario should be short and simple e.g.
Scenario: After I login I see my dashboard
Given I am registered
When I login
Then I should see my dashboard
Notice how there is nothing in the scenario about clicking, filling in login details, or being registered.
Cucumber is designed for doing BDD. Behaviour Driven Development. So you start from the When which describes the new behaviour you are going to develop. Then you think about the Then, which describes the results you should see after you have done the new behaviour. Finally you think about the Given which is all about what you need to have done previously so you can do the When.
So for you next scenario viewing courses you would start with
Scenario: View my courses
When I view my courses
then you would move onto
Scenario: View my courses
When I view my courses
Then I should see my courses
and finally for the Given you need to be viewing your dashboard so.
Scenario: View my courses
Given I am viewing my dashboard
When I view my courses
Then I should see my courses
Each new piece of behaviour builds on existing pieces of behaviour.
Viewing courses builds on viewing the dashboard
Viewing the dashboard builds on login
Login builds on registration
Hopefully this provides a good start.

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.

What type of feed is most appropriate for a feed in a user profile that shows all of the posts that he or she has voted on?

I am writing an app where users can make posts.
Each post has a vote button. In the user's profile page, I would like to have a feed that shows all posts that were voted on by the user.
In this case, should I create a Flat Feed named "voted"? Then, would I add an activity to "voted" each time a user clicks on the vote button of a post? Is this best way?
I am new to the getstream API so any feedback to enhance my understanding of the API and its possibilities would be much appreciated. Thank you.
It seems that "vote" action in my case would be best represented as a "reaction" in the getstream API. So, the write up on reactions in the docs seems to be a good starting point: Reactions

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.

Resources