GetStream / stream-js

JS / Browser Client - Build Activity Feeds & Streams with GetStream.io

Home Page:https://getstream.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get list user commented in a post or comment

toannv1803 opened this issue · comments

I write in-app notifications and want to notify all users who commented in a post or comment.
I use API filter reactions and receive only 25 reactions (max limit). if a post has a lot of comments, I don't want to call a lot of times this API to get list users.

let arrUser: string[] = [];
// add notification to user in conversation
const payloadFilterComment = { kind: 'comment', limit: 25 };
if (activityId) payloadFilterComment['activity_id'] = activityId;
else if (commentId) payloadFilterComment['reaction_id'] = commentId;

const data = await this.getstream.reactions.filter(payloadFilterComment);
data.results.forEach((comment) => {
  arrUser.push(comment.user_id);
});

How can I get a list of users as I mentioned above?