chat
chat copied to clipboard
Feature list
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
isnull
. 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
WIP https://github.com/musonza/chat/pull/227 > Event if messages have been cleared or deleted by ALL parties
Reduce all returned data to a minimum in order to save bandwidth and data -> this can already be done with Transformers
@Hirbod cleaning up messages - https://github.com/musonza/chat/blob/master/README.md#cleanup-deleted-messages
@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?
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
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..
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.