Adalo Chat App Template - How to Remove Duplicate 'conversations'

Great question. It actually uses a text field in the conversations collection called Participants Index that is a concatenated field of both users emails. The Conversation count is then filtered by if the Participant’s Index contains the current user email and also the Logged in use email. If the count is greater than 1, the list appears. If the convo count is 0 then the button to create a new convo appears.

2 Likes

@pfordmedia Thank you for the explanation! I managed to make the buttons appear/disappear based on the Participants index, but I still have an issue of redirecting the logged in user directly into the current conversation in case it exists as the current conversation data is not in the transferred data as I am trying to send that message from a different screen, not the one that has a list of conversations… so the only way I can do it, as it seems, is to redirect to the list of conversations first… but if there are already many of them there then it is not user friendly… what am I doing wrong or how is it possible to still redirect directly into the current conversation like it is in instagram? Thanks again for all your support! It is really helpful:)

Yes it’s kind of weird, but basically the button itself needs to be a list of conversations that is limited to show only the conversations where both people’s email is in the participants index. Rather than just changing the visibility of the button, these will be filters on the list. You can make the button a list by clicking on the button, then the three dots, then Make List. That button within the list will send the user directly to the messages screen.

Sorry for the way late reply. To count the conversations you share with another user, you’ll need an Index (text field) of all the user’s emails. You will then count the number of conversations where the Index contains both the Logged in user’s email and the current user’s email.

@pford now it works! I really did not have the button as a list… Thanks!!

The only question left is how to make the buttons always invisible at all if a user sees his/her own post with no possibility to set a chat with him/herself? It still sends to a chat but to the conversation with the other user. Could you please advise? I thought that would happen by default but somehow I still see that button and it redirects to one of the existing conversation with one of the users… thanks again!

I fixed it! So there is no issue anymore. Thanks again!

If you want to implement a modern chat that initiates and finds the chat again in a elegant way, check this video out: https://www.youtube.com/watch?v=5YNZSP-IPvI

1 Like

I know this is a zombie thread, but just wanted to quickly say thanks. Might be inelegant, and now that you explain it, it’s obvious - but I couldn’t work out how the hell to do it before reading this, so thanks a bunch :smiley:

1 Like