-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft message not visible on deleted message #25484
Comments
Hi @ochan12, I wasn't able to reproduce this just now. Are you able to reproduce this on our community server https://community.mattermost.com/, which is on the latest version? |
Hi, @amyblais I was able to reproduce it in the community server by doing.
|
@ochan12 after the root post is deleted and does the Draft count update properly after you click away from the Draft section to somewhere else? |
Hello @marianunez @amyblais, I would like to grab this. I explored the code and found that when a user deletes a post two delete requests are sent to the server, one for the post itself and one for draft. The server only deletes the draft of the sender, but other users' drafts will stay in the db like an orphan draft without I also noticed that even if we somehow manage to delete those records from DB, we still have more draft count. It is because we store the draft in the IndexDB of the browser using the Possible Solution
Let me know your suggestions and insights. 💡 Thanks |
Thanks for looking into this issue @Utsav-Ladani! @devinbinnie any thoughts on the approach above? |
Seems good to me. |
Hello @devinbinnie! I've successfully identified and resolved an issue, implementing the fix as outlined above. My solution involves removing drafts from the server upon deletion of the root post. However, there's a hiccup with locally stored data. In the proposed fix, when a user deletes a post, all associated draft comments are promptly deleted on the server side. Subsequently, the user receives the The challenge arises when a user is offline, preventing the reception of the Upon the initialization of the React For a detailed look, refer to: mattermost/webapp/channels/src/actions/views/drafts.ts Lines 34 to 72 in 4890715
This code snippet reveals that the The crux of the issue lies in how the server and locally stored drafts are merged. The provided code demonstrates that the merging step only adds new drafts to the store without removing others. This assumption is based on the belief that other drafts are from different teams. Considering that drafts are fetched every time, the question arises: why do we need to store them in local storage within the merged map? My proposed solution:
Please help me to choose the best solution Thanks |
So the problem with 1) is that we can't guarantee that a draft was stored on the server in the first place, and this means that we could lose locally-stored drafts from when the app was disconnected. What would 2) involve? I know we have the |
Hello @devinbinnie I created a draft PR and left a comment to resolve. Can you please help me resolve it? |
…raftsAssociatedWithPost method
* [GH-25484] Fix draft removal on post deletion * [GH-25484] Add batch migration to remove orphan drafts * [GH-25484] Fix tests of migration and draft store * [GH-25484] Remove translation file changes. * [GH-25484] Remove translation file changes. --------- Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Thank you all 🎉 |
@marcin-kwiatkowski the fix for this one should land in v9.6 server so seems to be expected to be still an issue in your server that is 9.4.2 |
Thank you for response 💪🤝 |
Summary
I started a reply to a message from someone else, then that message got deleted and now I have the draft counter on 2 (because I tried it again just to be sure), but no draft messages appear when clicking on it
Steps to reproduce
OS: Arch Linux 6.4.16-5-MANJARO
Client Version: 5.5.1
Mattermost Version: dev-linux-arm64-v9.0.1
Database Schema Version: 111
Database: postgres
Expected behavior
I found this issue where it says it was fixed but for me the badge is still showing draft messages. I would expect the same thing, the badge counter to disappear.
The text was updated successfully, but these errors were encountered: