Does Getstream support "seen" and "unseen" posts?
Essentially, I'd like to be able to show the user the number of new posts that have been posted to the feed since the last time they visited it. After they see the new posts on the feed, reset the number of unseen posts to 0.
I'm aware that the notification feed has similar capabilities but best practices wise, it doesn't seem like a good idea to use that instead of a flat feed (maybe i'm wrong)
UPDATE SCENARIO
Every user has a (global_feed_notifications:user_uuid)
that follows (global_feed_flat:1)
A user adds an activity to their (user_posts_flat:user_uuid)
The activity has a to:["global_feed_flat:1"]
The expectation is that (global_feed_notifications:user_uuid)
would receive the activity as an unseen and unread notification due to a fanout.
UPDATE
The scenario failed.
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);
});
}
UPDATE
Well I'm not sure what happened but it suddenly started working after a day.
Unread and unseen is only supported on notification feeds. You could set up your aggregation format to {{ id }}
to avoid any aggregations but still leverage the power of unread and unseen indicators.