cmgmyr/laravel-messenger

How to hide deleted message for one user

debuGhy opened this issue · 3 comments

Suppose User A has deleted all the messages in the thread with user B. Now user B is able to check all the messages in the thread but user A is not which is good. Now when User B sends a new message to user A then User A is able to check the all his deleted message as well.
What I want to achieve is if user A deletes a thread for himself then he shouldn't be able to view all deleted messages if user B sends a new message.

Can anyone help me on this?

hey @debuGhy, thanks for using the package!

I have the opinion that if User B replies to an old/deleted thread then it should just reactivate the thread for the user that deleted/hid it. This makes the application code a little easier to manage.

One thing that you could do is only show User A the newest messages only, hiding any that came before the deletion. That way you could keep the same thread.

Hope that helps 🙂

Also coming up against this, maybe it's best to have an extra column in participants, deleted_thread_at then we can only show messages that appear after this date.

Hello @cmgmyr , Thanks for your suggestion.
I added two columns in database.
Table: threads
New columns: delete_creator,delete_participant

Table: messages
New columns: delete_creator,delete_participant