Good practice for flagging when message has been seen

Hi Bubblers,

I am implementing an activity feed aspect to my app and I’m thinking through different ways to flag when a user has ‘seen’ a message that has been added to a feed.

A couple of thoughts I’ve had are;

  • always assume that when the user clicks the ‘Activity Feed’ button that it timestamps on the user datatype so the unread notes counter will count the number of notes with a created or modified date greater than the current users last activity timestamp.

or

  • implement a workflow that looks at whether the current cell (i.e. the activity feed item) ‘has focus’ by the user and write the current user username into a list on the activity (not sure how I would go about this).

Do either of these resemble good practice or is there another best practice way of doing this in Bubble??

Thanks all.

I’m also interested in how to do this. Is storing the user as a list thing the best way to do this? If you store users as a list thing, what is the best method to recalling and displaying if they have seen the message of if its a new message? Can you set the state of an element somehow?

In terms of storing the user in a list on the message data type, the only way I can think through this is to present the messages in a repeating group and when the current user takes an action (such as clicking on an ‘activity feed’ button, set a state of type user on each repeating group cell (each message). Then, when the user navigates away, (clicks a close button for example), run a workflow that changes the message thing and inserts the current user into the ‘user viewed’ list (of type user) on the message data type.

I think the next thing to do is to search for messages where the user list does not contain the current user.

You can then count that result or use it as a data source in a repeating group.

I’m not sure that’s the most efficient way to do it, but I’m fairly confident that’s how it can work.

What I don’t know how to do is to dynamically add the user to a list when the message (repeating group cell) is in focus to truly reflect that the user has ‘seen’ the message.

Hope that makes sense.

You could always make it like an email UI and have a mark as read button or something similar. Depends on where you’re using this if that makes sense though.

That’s a thought. I will have a look at that as an option.
Not sure I want to enforce that on the user to have to ‘clear’ their list, but I’ll see how it flows.

Thanks for the input.

I am trying to achieve that function. Is this somehow possible?

@emmanuel

can you maybe just give a little hint???

to be more precise: How can I trigger a workflow to mark a message as “read” without the need to have the user click a button. its like: Message is displayed and current user is currently on that page → mark message as “read”

I would think the first method (user timestamp) was a better method. Set it on page load, and maybe add a minute to the time (so they don’t get flagged as read immediately).

The alternative would be to do the same with the user list on page load. But again you would need to make sure there was a delay. You could potentially schedule an API workflow from page load that marks them as read in x minutes from page load.

1 Like