You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got the following in my ActivityService which writes all activites:
def create_activity(user_id, action, resource, time = Time.now.utc)
event = SimpleFeed::Event.new(
{
a: action,
u: user_id,
r: resource.class.name,
rid: resource.id
}.to_json,
time
)
@activity_feeds.each { |feed| feed.store(event: event) }
end
I've noticed that if the same user performs the same action (such as "document.edited") on the same resource, it will overwrite the previous activity. This is actually desirable - one user editing the same document 10 times would clutter the activity feed and only the most recent activity item is relevant. It'd be nice if the overwrite logic was documented on the readme. I'm wondering if there's a way to override this however. I'd like a new activity item to appear if the same user edits the same document on a different day than a previous edit.
Perhaps I should include the current 24hr period since epoch to make the events unique across days? Such as:
That’s correct. Because simple feed uses Redis Set behind the scenes you can only store an identical event once. To store each event individually you need to add the date or the day to the event itself, which is exactly what you’ve done in your example.
I've got the following in my ActivityService which writes all activites:
I've noticed that if the same user performs the same action (such as "document.edited") on the same resource, it will overwrite the previous activity. This is actually desirable - one user editing the same document 10 times would clutter the activity feed and only the most recent activity item is relevant. It'd be nice if the overwrite logic was documented on the readme. I'm wondering if there's a way to override this however. I'd like a new activity item to appear if the same user edits the same document on a different day than a previous edit.
Perhaps I should include the current 24hr period since epoch to make the events unique across days? Such as:
The text was updated successfully, but these errors were encountered: