Delete a chat for one user only (logged in user)

Hello, Can someone help me manage the deletion of the chat only for the requesting user (logged in user).
In practice at the current state if the user clicks on the “Delete Chat” button, this is deleted for the logged in user (Correct) and also for the user who is a member of the chat (current user - incorrect!)

As I let you imagine it is not nice that a user deletes his chat, and the other person also gets deleted. Those messages for the other user could be important information or just memories.

How can I then remove the user who requests it from the chat?
Has anyone ever tried? Furthermore, it would also have to be managed:

If the user who deleted the chat (logged in user), wants to start a new one with the same user. He will have to see the empty chat, the other user (current user) if he still has the entire chat, he should see the new messages appended to the existing ones.

I think it will be necessary to intervene on the “Current conversation”.

I am attaching some screenshots of what I have prepared:
Buton Screen:

First List chat

Second List Chat

Conversation Collection

Message Collection

thanks so much…to all

Have the delete conversation button remove the logged in user as a member of the chat. So technically the chat will still exist, but the logged in user will not longer be able to see it in the list of chats.

I had already tried this solution: But I do not understand why the other user (current user) still does not see the chat (although it is a member and has not been deleted) … the collections and the database is what you can see. Can you help me understand why the other user doesn’t see the chat?

Furthermore, however, doing so does not solve a problem:
When the user who deleted the chat (logged user) if he wants to start a new chat with the same user, at that moment of the selection a new conversation will be created (with two members), this is a problem because then the other user (curretn user) will see an old and a new chat in their conversations.


That is strange. If the database is still showing the other user as a member, then the conversation should be visible to that user. Try when testing opening a new incognito window and open app there (with share link not previewer) for logging in the different user. From your screenshots I don’t see why it should break.

With regards to having two conversations, you need to think about why you want a user to delete a conversation and start again and build it around that. Maybe just add the user back to the old conversation so it appears again for logged in user, without creating a new one?

I was able to take the test you said. but I had to remove the condition in the list that DOES NOT SHOW conversations of which I am the only member. doing so if the user (another user) deletes his chat (leaves members). I logged in user will be the only member of that conversation, so the chat list will correctly show me conversation, but not finding any relationship with the old user, it will replace all links (profile, names, etc) with that of the logged in user ( reader, that is me) … this is not good, you have to understand how to save the information of those who leave the chat elsewhere, in order to recall their name and data.

the other problem of those I mentioned to you: the user who has left the chat why can he re-enter? because he may just want to lose those previously written messages or hide his conversation (losing the messages). your solution of being able to add the user again if the chat exists, can be good: but how to do it? how can I intercept and understand if the conversation where he resided (in the past) with the selected user already exists? and can I update the conversation to add it back and not create it?
how can i check that the chat already exists?

however, this would ensure that the broadcaster, returning as a member to the conversation, would find his old messages again. instead his own would be permanently deleted (only his relative to that conversation)…this is hard.

Thanks man.

Up please. anyone who can help me?

Up Up please. anyone who can help me?

Up Up please. anyone who can help me?

Could you please explain your issue in more detail?

I have the same issue… I create a chat in my app and I discover if you delete a chat it disappears in both users… and try to talk again with same user creates a new chat in list, so current user have 2 now

1 Like

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