Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

Handle conflicts arising from simultaneous editing on app + web #144

Closed
Windyo opened this issue Sep 18, 2016 · 11 comments
Closed

Handle conflicts arising from simultaneous editing on app + web #144

Windyo opened this issue Sep 18, 2016 · 11 comments

Comments

@Windyo
Copy link

Windyo commented Sep 18, 2016

FILL THESE DETAILS FIRST:

  • App version: 1.3.2
  • Android version: 6.0.1
  • Device name: Samsung S7 Edge

Clicking on a post in quill, swiping, making no edits and swiping again because you know the server version is more up to date, results in the server post being overwritten with the quill one.

Suggestion : de not trigger "edit" behavior if there was nothing typed during the session.

Other suggestion if online, do a version check before accepting edit mode.

@vickychijwani
Copy link
Owner

Hi @Windyo! I'll have to look into what's really causing this - thanks for the suggestion.

I don't think I understand your 2nd suggestion - do you mean check whether the server has a newer version of the post and if so replace Quill's copy of the post with the one on the server?

@Windyo
Copy link
Author

Windyo commented Sep 18, 2016

Hi @vickychijwani !

yeah my second suggestion is just to do a diff check if online between quill and the server, then ask what should be done if a diff exists. I don't know if you can get the savedate from a post in the database, so that would work in any case

@Windyo
Copy link
Author

Windyo commented Sep 18, 2016

Adding to this issue : if you use Quill to update a post which Quill knows is published, it won't force-push anything and instead display "changes auto saved, not pushed to server" untill you press "update post", which is great.

. However if you published a draft via the web interface and quill still thinks it's a draft, it will overwrite with extreme prejudice if you ever go into edit mode.

@vickychijwani
Copy link
Owner

Yes, Quill was not really designed to handle concurrent editing from the app + Ghost. Question: is this a real use-case for you? I had decided to ignore it because it seemed overkill to handle such a rare scenario.

@Windyo
Copy link
Author

Windyo commented Sep 18, 2016

I actually use Quill + the Ghost desktop app + the web interface.

My use case is :

  • start typing on quill
  • add some media that can't be addded on mobile via ghost desktop
  • sometimes use the web app if I'm not on my computer.

It happens pretty often that I will start a post on quill, continue on the computer and then finish it up later on quill before posting.

All in all it's not worth doing a whole lot of code for. The only thing that should be needed is a diff check and then for ce to take action if a diff exists, whatever it is.

@vickychijwani
Copy link
Owner

Interesting. Let me get back to you on this.

@stuartbfox
Copy link

Yes please! Quill just over-wrote 2 days worth of a post.

I started using the Ghost web editor, then added some content from quill (photos) then continued on the web editor and published from there. Next time I started Quill the post got marked as draft and the content was over-written.

@vickychijwani
Copy link
Owner

vickychijwani commented Nov 7, 2016

@stuartbfox so sorry to hear that! I made a fundamentally incorrect assumption here: that the user will always exit the post editor and go back to the post list when they're done editing a post (which, by the way, I recommend you to do until this is fixed). Now I realize that's just how I work and not reflective of others' behaviour. Clearly this needs fixing.

Dev notes: All that's needed to prevent data loss is:

  1. On saving a post, update its updatedAt time to the current time, then,
  2. Download each edited post before uploading the local version, and check that its updatedAt timestamp exactly matches what we have in the local database - if not, there's a conflict and we can present a simple dialog to allow selecting the server content, the device content, or doing nothing (default to the 1st option; show last-updated timestamps for 1st and 2nd options; the 3rd option will skip this post entirely, postponing the decision). Will have to test how this interacts with: (1) published posts having auto-saved edits, and, (2) another sync being triggered while a conflict remains unresolved.

@stuartbfox
Copy link

That all sounds reasonable. I dont suppose quill stores a copy of the downloaded post does it?

@vickychijwani
Copy link
Owner

No, it doesn't.

@vickychijwani vickychijwani changed the title Swiping on a post may overwrite server content Handle conflicts arising from simultaneous editing on app + web Dec 5, 2016
@vickychijwani
Copy link
Owner

vickychijwani commented Dec 5, 2016

@Windyo @stuartbfox I have some good news: Quill will be released with a simple conflict handling UI today!

screenshot_2016-12-06-03-07-55

The way this works is: before uploading any edited post, Quill will first download the latest server copy and compare them. If the device's copy has a different updatedAt timestamp and the contents are different, it will trigger the conflict resolution UI shown above.

Note that conflicts must be resolved immediately, there is no way (yet) to defer the decision. But you can force Quill to re-fetch the server copy once more after making some more edits from Ghost, by simply tapping the back button (this is a bit of a hack, but I figured most users who have conflicts won't need fine-grained control - this is open to discussion of course).

Watch out for the v1.5.0 update from the Play Store :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants