Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know user like activity? #463

Open
toannv1803 opened this issue Jul 19, 2021 · 1 comment
Open

How to know user like activity? #463

toannv1803 opened this issue Jul 19, 2021 · 1 comment

Comments

@toannv1803
Copy link

toannv1803 commented Jul 19, 2021

I use this code to get feed but audience can't know they like or not like this activity, unless i get all reactions.

    const timeline = this.getstream.feed('timeline', '...');
    const data = await timeline.get({
      offset: option.offset,
      limit: option.limit,
      ownReactions: true,
      withRecentReactions: true,
      withReactionCounts: true,
    });

When i filter reactions with user_id and activity_id, i catch error: Must provide exactly one value for one of these params: user_id, activity_id, reaction_id.
How to know user like activity and don't query all reactions kind "like"?

gz#13672

@SeniYG
Copy link

SeniYG commented Jul 19, 2021

Hi,

Thanks for reaching out.
You can only filter reactions by one of those fields, i.e user_id or activity_id, or reaction_id. The API does not support filtering by both user_id and activity_id. That being said, the best way for the current user to know if he liked a given activity, would be by retrieving its own reactions. You can typically do that as you mentioned, i.e using the ownReactions field while reading the feed :

const data = await timeline.get({
      offset: option.offset,
      limit: option.limit,
      ownReactions: true,
       ...
    });

Best,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants