chat-sdk-android icon indicating copy to clipboard operation
chat-sdk-android copied to clipboard

Messages aren't being deleted when user deletes a thread. Bug?

Open RyanElliott94 opened this issue 9 years ago • 8 comments

So i don't know if this is intentional or if it's a bug but when you delete a thread, it keeps every message that was sent inside that thread?.

I only ask because to me, deleting a thread means deleting an entire conversation between 2 users which would mean the conversation being gone forever

RyanElliott94 avatar Mar 21 '17 21:03 RyanElliott94

Hi,

This is intended to make it easier to re-enter a group thread But the functionality should probably be talked about. It is misleading that the threads are not deleted unless the app is uninstalled.

I'd like to propose three delete options for threads in the future versions of the app. softDelete (remove links to the thread), hardDelete (remove the thread items, and possibly in the database too), and forceDelete (force the thread to be deleted from not only your device and the server, but the other parties device too).

@bensmiley What are your thoughts, should any of these be native, could they be part of a privacy add-on?

kykrueger avatar Mar 24 '17 17:03 kykrueger

Currently, we don't delete messages that are stored on the server when a thread is deleted. In most other messengers, when a message is sent, it is not stored on the server. The server just delivers the message and once it has been delivered, it is deleted from the server. We don't currently do that. This has benefits because it means that if you delete the app, you can still re-install it and get your messages back.

Only using the server to deliver the messages is difficult because Firebase can't host code. Usually, the server would retain a list of recipients and would hold on to the message until it had been delivered to each of the recipients. This isn't possible with Firebase unless a secondary app server was used.

For 1-to-1 chats, it would be easy to just delete all the messages when a thread was deleted - this may be the best solution.

This would be tricky in a group chat because the messages "belong" to all the members. Should they really be deleted when one member leaves the group?

bensmiley avatar Mar 28 '17 06:03 bensmiley

Well i would be happy with just being able to delete 1-to-1 chats completely as i have a feeling most of my future users will opt to use 1-to-1 oppose to group chats.

So do you think that would ever be implemented?

RyanElliott94 avatar Mar 28 '17 11:03 RyanElliott94

I've added this issue to the Feature Requests milestone. It's not possible to give a date for when we will have time to implement it. You could probably do it yourself by just removing the messages path from the thread. If you would like us to do the work, I'd be happy to give you a quote. It probably wouldn't take more than a couple of hours.

bensmiley avatar Mar 29 '17 02:03 bensmiley

Hi @RyanElliott94,

There is an interesting article here on how WhatsApp do it:

1-to-1 chats When a user deletes the chat then all the messages are deleted between the two users

Group chats This builds on the WhatsApp feature of a user being an administrator for the group. If the admin deletes a thread then the entire thread is deleted and everyone is kicked. If a normal user clicks delete then they only leave the group (the button says exit instead of delete).

For 1-to-1 deleting it would probably be possible to do as Ben said, remove the message path from the thread.

For group then we would need to make some modifications to the chat. Adding an administrator is easy (just add a new field to threads and then set the userEntityID when a user creates it). You can then link the delete status in with a check to see if the userEntityID matches the adminID.

Note: Don't forget that current a thread will appear even if it has no messages in it. You might want to remove this feature if you add this functionality as users will not want empty threads showing when they delete a thread.

simonsmiley64 avatar Mar 29 '17 02:03 simonsmiley64

It's all sounding promising but for now i will leave it as it is but once the app is released (Possibly tonight) and i have money coming in, i will think about coming up with a quote but right now i simply don't have the money for it.

If however one of the teams chooses to do it as an update for the SDK and none of you are able to test the code on real devices then i would be happy to test it!

Ryan

RyanElliott94 avatar Mar 29 '17 14:03 RyanElliott94

I thought I'd quickly update this! My app is currently going through a major update and one of the new features is a full conversation delete method which is fully working. I'm not going to put the code here because I'd rather not having everyone knowing how to use the code the way that i have! But if any of the team are interested in seeing or using the code then please let me know and i will email it to you.

Thanks

Oh i forgot to mention, the method is only for 1-1 chats!

RyanElliott94 avatar May 03 '17 13:05 RyanElliott94

Hi @RyanElliott94,

We are always looking to improve the Chat SDK so if you want to send us some of the delete code we can see how it looks. If you are happy for us to use it to adapt the Chat SDK that would be great.

You can get in touch with us at [email protected],

Otherwise if you have any other features or improvements you can always submit a pull request so we can checkout the changes and push it to the repository,

Simon

simonsmiley64 avatar May 03 '17 15:05 simonsmiley64