Help filtering comments/chat by groups and roles

Hello all: I’ve tried solving this myself but hit enough dead ends I’m hoping there is an easy solution I’m not thinking of. In the app, users have roles that put them into different groups, e.g. Group A and Group B. There are items, like books, that all users can see, but I want their comments on those books to be only seen by users in their groups (I.e. Group A’s comment on book 1 can only be seen and replied to by Group A members. Group B’s comments on the book 1 can only see and reply to Group B members). That I’ve set up fine. The twist is that I want anyone with the role of admin to be able to see and respond to comments in both groups.

This creates two related problems. One, making sure that the admin comments stay in their lane…group B only sees the admin comments meant for them and likewise group A…and never the twain shall meet. By the same account, when the admin looks at the group B page or the group A page they are only seeing the comments they made for the right group not all of their comments that relate to that book.

It seems like the approach with row owners that @Robert_Petitto uses in this video 💬 Chat Component: A Complete Walkthrough for keeping the chat between two users private would work, but I can’t figure out how to adapt that approach here where there are multiple users from one group and one user from another group (I.e. admin). I either get everything or nothing or everyone but no admin…

Welcome any suggestions.

Add a new column as a row owner and set its value to “Admin.” This will allow the admin to view all the data.

When the admin adds a message to a group (e.g., Group A), update the appropriate column with the group name (e.g., “Group A” or “Group B”) after submitting the message. This ensures that the specified group will have access to the admin’s messages intended for them.

Exactly. This table will have 2 row owner columns. One that will always have the “Admin” role defined. The second will have which group is defined. The only caveat is that these Admins can’t also belong to a group with the same email address unless you’re using Airtable or Google Sheets as your users table.

The way I handle this is by having a similar setup in the user’s table. Two columns:

  1. the role column (which determines if a user is Admin, Group A, Group B, etc.)
  2. an “Admin Access” column that only ever has the word “Admin” in it so that Admins also have access to user table data.

When the comments are submitted, you can simply populate the Comment → Admin Row owner column with the “Admin” value found in the user’s Admin Access column.

Make sense?

Fantastic. That worked! Thank you both.

1 Like

Anytime!

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