chat icon indicating copy to clipboard operation
chat copied to clipboard

Feature list

Open hirbod opened this issue 4 years ago • 7 comments

Hi @musonza,

as wished, I made a list with recommendations. Open for suggestions and discussions.

  • [ ] Add a method to strip out conversations for the requesting user, when last_message is null. Currently I do this with a ->filter() but this forces me to recreate the LengthAwarePaginator.
  • [ ] The total count of unread messages (maybe as chain function ->withUnreadCount() or parameter) when calling for users conversations (to show a unread counter in the inbox)
  • [ ] createOrReturnConversation() for directChats, so prevent multiple 1:1 conversations. There might be cases where users want to have multiple 1:1, therefore the best would be a own method or a chain function
  • [x] Event if messages have been cleared or deleted by ALL parties in a conversation which are != text, so we could make operations to clear up space (eg. delete images or videos). Before the deletion is done, we need to be notified with the message object so we can check the message-body (mostly it contains paths or URLs to the files, so we could unlink() them)
  • [x] Reduce all returned data to a minimum in order to save bandwidth and data

hirbod avatar Nov 07 '19 12:11 hirbod

WIP https://github.com/musonza/chat/pull/227 > Event if messages have been cleared or deleted by ALL parties

musonza avatar Nov 27 '19 04:11 musonza

Reduce all returned data to a minimum in order to save bandwidth and data -> this can already be done with Transformers

hirbod avatar Nov 27 '19 04:11 hirbod

@Hirbod cleaning up messages - https://github.com/musonza/chat/blob/master/README.md#cleanup-deleted-messages

musonza avatar Nov 28 '19 02:11 musonza

@musonza What's in the body of the event for the cleared conversation? (assuming there are 10.000 messages). Will we reach memory limits here?

hirbod avatar Nov 28 '19 02:11 hirbod

Just the conversation https://github.com/musonza/chat/blob/bb0aa0d1c7d99e9eeb975c2e492fc598ba43cb00/src/Eventing/AllParticipantsClearedConversation.php#L13. You will need to do a little work and query for the messages from that time of deletion and handle as you see fit. Yes, including the messages won't make sense

musonza avatar Nov 28 '19 02:11 musonza

So the messages aren't actually deleted, just a timestamp will be added? (soft delete?). If yes, the whole event thing would be actually obsolete... because we could register a cronjob and just query for deleted_at. Haven't thought of this..

hirbod avatar Nov 28 '19 02:11 hirbod

We only store one message in the messages table to avoid duplicating for participants. The notifications table is the one we do soft deletes on.

musonza avatar Nov 28 '19 02:11 musonza