fix: Update chats.update_last_messages trigger to make sure it is only called for actual last message in case of update #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do?
update the
rooms.lastMessages
when the actual last message of room is updated and not any other messageWhy is it needed?
it can be the case that a message got updated that is not actually the last message, in that case the
rooms.lastMessages
should not be updated. this pr fixes thatyou can see here in example app we update message status
but we do it for multiple messages and it is not necessarily that the last message in room will be updated last which can cause
rooms.lastMessages
to be updated with some other messageHow to test it?
you can test it after running the migration and running the example project that the issue i described is fixed by this change