-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix issue where two identical drafts were created #10009
Conversation
Nice catch @malinajirka ! Will check and test later 👍 |
Btw I was also thinking about adding something like this
here. However, the posts aren't equal - they have different |
For the sake of comparing, I think you could just check for However, at that point, if another post with same id is currently being uploaded then it makes sense to enqueue the Post being passed as parameter now (as the latest version / modification should be coming in anyway). Wdyt? |
If you follow the test scenario #1, an identical version of the post is enqueue twice - in steps 4 and 5. I would like to prevent the second upload as it's pointless. However, I actually need to do "full" comparison as otherwise the test scenario #2 wouldn't work -> we wouldn't update the post with "1234". |
Oh that's right, I see that now. It may be worth it to check every other field except |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR LGTM, this takes care of the issue.
Optimisation being discussed in the comments can be continued elsewhere / even here after merge happens.
Thanks @mzorz for the review!;)
I agree, but comparing them manually seems a bit clumsy + if we ever add a new field, we might not remember to update this comparison. We could create a second equals in the PostModel, but it just doesn't seem right to me. I'd probably vote for keeping the current behavior. The double-upload won't happen that often and the only downside is that we upload the post twice. I believe it's not such a big deal. Wdyt? |
Agreed, that's a reasonable trade off 👍 |
Fixes #9347
Two identical drafts were being created under certain circumstances.
I've noticed that before we add a post into the
sQueuedPostsList
we check if it's already there and when it is, we just update it. However, the issue is that if the post is being uploaded at the moment, it's no longer present in thesQueuedPostsList
.When we finish the upload of the first instance of the post, the upload of the second instance starts. However, it's still marked as
localDraft
and it doesn't have validremotePostId
. This PR fixes the issue and updates these two fields when the upload of the first instance of the post finishes.To test:
Update release notes:
RELEASE-NOTES.txt
.Before/After gifs