How to block users in a group chat

Hello guys,

I need a help. We are currently trying to figure out a way how to block users and then filter messages based on the list of blocked users.

Our scheme looks like this:
We have a lot of group chats (Collection: Chatrooms) each Chatroom has it’s messages (Collection: Messages - each message has it’s sender) and Users who belong to the a certain chatroom (Collection: Users).

When the user clicks on other user, they get on their profile and then there is the “Block this user” button to block that particular user.

However the issue is the following: We were unable to filter out messages based on that sender.

So the logic should work like: If the message sender = One of the blocked people by the currently logged user THEN hide their message. I was able to get it working, but only if 1 user can block only 1 user. If they blocked another user, the previous one get’s unblocked. When I tried using all the relationships between 2 users, only if I used Many:Many relationship I was able to assign multiple blocked users to each individual user, but then the filter in the chat just didn’t allow me to filter it. When there was only 1 blocked user, I could filter it like: Message sender → email = BlockedByUser-> Email. With the many:many solution, this option disappeared and it keeps showing me all the different tables till I ran out of my screen real estate.

Can anyone please suggest any advice/help/solution?

Thank you in advance,
Jerry

1 Like