How to show a list of users who have "Read" a comment

I am trying to create a screen in my app to show the users that have read a comment. So, it would be rather like FB messenger which shows it has been read and you can then list icons of each user as each user reads it.

The principle appears simple, an inline list showing a relation as each comment fills with users that have read it. But this is where I am stuck

How do I record when a user has “seen” a comment? There seems to be no obvious way of tracking and recording this data.

Being new, naturally, I was looking for a tool that maybe is “hidden” that records a “view” event. When that event = true, then the user identifier (in my case their email) is recorded in the COMMENTS table. The relation simply sees these emails against the comment to “know” it is read.

Does this make sense?
James

I think you can do it like this.

  • Have a column in your comments table that holds the list of user emails that have read the comment.

  • Add an if then else column to cover all the possibilities of a user when they enter to read the comment.

If email list (step 1) is empty, then {E}.

If email list (step 1) does not contain signed-in user’s email then {L}, {E}.

If email list (step 1) contains signed-in user’s email then {L}.

  • Construct a template column using the if then else result above, and replace {L} by the existing email list, {E} by the signed-in user’s email.

  • In the action that leads user to read the comment, you will first set the template column above to the email list (to update it), then show the detail screen of the comment.

You can then use an inline list pointing to your users table, filter by email is included in screen’s email list and display their images.

3 Likes

Also, if you’re not too worried about knowing who’s read the “comment” but you just want a user to know which they’ve personally read, then a simple User Specific boolean column would suffice. This would allow you to show a user all comments that they have yet to read, for example.

2 Likes

Thanks @ThinhDinh for your help here. I think this adds the email each time someone views so although it works, it will keep adding email addresses to my table making it large.

However, I really like the if then else thing - thanks for that! And I never thought of the template suggestion - brilliant.

Thanks @V88 this has done the trick as it stops the email from being recorded mutlitple times. IT is a true or false for that user as they only need to see it once to have been “read” I dont need to see how many times they have read.

Problem solved - thanks everyone!

This part addresses it.

Saying the list is a@gmail.com, b@gmail.com then if b@gmail.com is viewing the comment, it falls into the last scenario and returns the same list, so you’re essentially writing the same value to the column.

1 Like

Oh yes thank you @ThinhDinh this helps too. It seems I have two ways to skin the cat. Will try it - thanks for your help

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.