在平面提要中获取看到和看不见的帖子
Getstream seen and unseen posts in a flat feed
Getstream 是否支持 "seen" 和 "unseen" 个帖子?
本质上,我希望能够向用户显示自上次访问后发布到提要的新帖子数。
在他们看到 Feed 上的新帖子后,将看不见的帖子数重置为 0。
我知道通知提要具有类似的功能,但在最佳实践方面,使用它代替平面提要似乎不是一个好主意(也许我错了)
更新场景
每个用户都有一个 (global_feed_notifications:user_uuid)
跟在 (global_feed_flat:1)
之后
用户将 activity 添加到他们的 (user_posts_flat:user_uuid)
activity有一个to:["global_feed_flat:1"]
预计 (global_feed_notifications:user_uuid)
会收到 activity 由于扇出而作为看不见和未读的通知。
更新
场景失败。
export function followDefaultFeedsOnStream(userapp){
const streamClient = stream.connect(STREAM_KEY, STREAM_SECRET);
const globalFeedNotifications = streamClient.feed(feedIds.globalFeedNotifications, userapp);
globalFeedNotifications.follow(feedIds.globalFeedFlat, '1');
}
export function addPostToStream(userapp, post){
const streamClient = stream.connect(STREAM_KEY, STREAM_SECRET);
const userPosts = streamClient.feed(feedIds.userPosts, userapp);
//expansion point: if posts are allowed to be friends only,
//calculate the value of the 'to' field from post.friends_only or post.private
const activity = {
actor: `user:${userapp}`,
verb: 'post',
object: `post:${post.uuid}`,
post_type: post.post_type,
foreign_id: `foreign_id:${post.uuid}`,
to: [`${feedIds.globalFeedFlat}:1`],
time: new Date()
}
userPosts.addActivity(activity)
.then(function(response) {
console.log(response);
})
.catch(function(err) {
console.log(err);
});
}
更新
嗯,我不确定发生了什么,但一天后它突然开始工作了。
未读和未见仅在通知源上受支持。您可以将聚合格式设置为 {{ id }}
以避免任何聚合,但仍然利用未读和未见指标的力量。
Getstream 是否支持 "seen" 和 "unseen" 个帖子?
本质上,我希望能够向用户显示自上次访问后发布到提要的新帖子数。 在他们看到 Feed 上的新帖子后,将看不见的帖子数重置为 0。
我知道通知提要具有类似的功能,但在最佳实践方面,使用它代替平面提要似乎不是一个好主意(也许我错了)
更新场景
每个用户都有一个 (global_feed_notifications:user_uuid)
跟在 (global_feed_flat:1)
用户将 activity 添加到他们的 (user_posts_flat:user_uuid)
activity有一个to:["global_feed_flat:1"]
预计 (global_feed_notifications:user_uuid)
会收到 activity 由于扇出而作为看不见和未读的通知。
更新
场景失败。
export function followDefaultFeedsOnStream(userapp){
const streamClient = stream.connect(STREAM_KEY, STREAM_SECRET);
const globalFeedNotifications = streamClient.feed(feedIds.globalFeedNotifications, userapp);
globalFeedNotifications.follow(feedIds.globalFeedFlat, '1');
}
export function addPostToStream(userapp, post){
const streamClient = stream.connect(STREAM_KEY, STREAM_SECRET);
const userPosts = streamClient.feed(feedIds.userPosts, userapp);
//expansion point: if posts are allowed to be friends only,
//calculate the value of the 'to' field from post.friends_only or post.private
const activity = {
actor: `user:${userapp}`,
verb: 'post',
object: `post:${post.uuid}`,
post_type: post.post_type,
foreign_id: `foreign_id:${post.uuid}`,
to: [`${feedIds.globalFeedFlat}:1`],
time: new Date()
}
userPosts.addActivity(activity)
.then(function(response) {
console.log(response);
})
.catch(function(err) {
console.log(err);
});
}
更新
嗯,我不确定发生了什么,但一天后它突然开始工作了。
未读和未见仅在通知源上受支持。您可以将聚合格式设置为 {{ id }}
以避免任何聚合,但仍然利用未读和未见指标的力量。