在 GetStream 中设置反应的参与者

Set the actor of a reaction in GetStream

我正在使用 Google Firebase Cloud Functions 在用户发表评论时向我的信息流添加反应 activity。

文档说您可以这样添加反应:

let comment = await client.reactions.add("comment", activityId, {"text": "awesome post!"});

但我在这里看不到如何设置反应的演员,即写评论的人。

我从文档中看到我可以设置目标供稿,即原作者 post 或评论中提到的人,但同样,这并没有设置写评论的人:

client.reactions.add("comment", activityId, 
    {"text": "@thierry great post!"},
   {targetFeeds:  ["notification:thierry"]}
);

N.B。这不在客户端中,而是一个无服务器功能。

如果您在服务器端使用反应,则在调用 reactions.add

时还必须包含 user_id

这是reactions.add

的签名
  add: function(
    kind,
    activity,
    data = {},
    { id, targetFeeds = [], userId, targetFeedsExtraData } = {},
    callback,
  )