List of conversations no longer contains empty conversations
Closes #420 (closed)
What does this MR do?
Writing a message to a user never spoken to before opens a new conversation window. This automatically creates a new conversation in the background that is stored within the db. Closing this empty conversation led to an empty conversation in the user's list of conversations.
A new ajax call was added to the existing close function in conv.js. Whenever a conversation is closed this way, the function checks whether the given conversation is empty (so no message was sent from any recipient). If so, the conversation is deleted in the db in both fs_conversation
and fs_foodsaver_has_conversation
. This way, the list of conversations is kept neat and sound and no empty conversations are added to the database.
How confident are you it won't break things if deployed?
Code changes are quite small and in one place. I'm not confident writing my own UnitTests yet, but local tests were successful.
Links to related issues
Checklist
-
added a test, or explain why one is not needed/possible... -
no unrelated changes -
asked someone for a code review -
joined #foodsharing-beta channel at https://slackin.yunity.org -
added an entry to CHANGELOG.md (description, merge request link, username(s))