Editing wiki posts at same time as someone else sometimes loses revisions

composer
wiki-posts
(David Taylor) #8

I might be interested in this once my GSOC project is over in a couple of weeks - the ‘presence’ features are somewhat related to my whos-online plugin. :slight_smile:

8 Likes

(Eli the Bearded) #9

One other thing that Mediawiki (the Wikipeda software) does is help prevent conflicts by letting people just edit sections.

Two people can edit two different sections (eg H1/H2 delimited blocks) at the same time and not see the conflict resolution page afterwards. The talk pages also have an “add new section” feature, which lets a new section be added with no risk of edit conflict.

8 Likes

(Erlend Sogge Heggen) #10

Discourse Presence - "Who is writing" now supports “who is editing”.

10 Likes

(Erlend Sogge Heggen) closed #11
0 Likes

(Sam Saffron) opened #12
0 Likes

(Sam Saffron) #13

I am reopening this cause the underlying problem still exists, even with presence. Sure we show that two people are editing. But only one person wins now and another loses.

We can sort this out very cleanly if our edit API always includes “this is the revision I expect to be it” with the payload and raises if the revision does not match.

So the process would be:

User A: starts editing (revision is 1)
User B: starts editing (revision is 1)
User A: hits save (current revision is 1) -> 200
User B: hits save (current revision is 1) -> 409
User B: presented with “It looks like the post was updated since you started editing, save anyway? (Yes, No)”

In theory we could do automatic conflict resolution as well which could make the wiki use cases a bit stronger. (calculate diff based off revision, and attempt to apply it to latest)

I do not want to gold plate the feature for the next release with full on conflict resolution windows proposed bye @alehandrof, that can come later. But at least saying “on no, you are going to nuke someone’s edit” would be nice.

Overall, the issue is a lot more of an issue if the community have lots of wiki topics.

14 Likes

Discourse Version 2.2
(Daniel Hollas) #14

That would be awesome, thanks so much!

Just stating the obvious here: one thing that kinda helps is to spread larger wiki post into several smaller ones and perhaps linking them together in the OP.

2 Likes

#15

This might be a silly idea, but what about pre-empting a revision number whenever the editor is fired, so that both revisions can be saved, and then after the conflict resolution can happen? If there’s no save, the revision can be dropped as a no-op.

1 Like

(Sam Saffron) #16

I worry cause effectively edits still get nuked for somebody and on large wikis it is very unlikely you would notice it till too late.

1 Like

(Régis Hanol) #20

@nbianca added a safeguard :guardsman:

https://github.com/discourse/discourse/commit/f60b10d090171c49134b20abcfb089ebb94fad21

7 Likes

(Jeff Atwood) #21

@nbianca can you add a cropped screenshot of this in action? That’d be :cool:

3 Likes

(Bianca) #22

Sure! 728 screenshots below :wink:

9 Likes

(Sam Saffron) #23

I see, I was hoping for a are you sure kind of prompt here vs this flow

6 Likes

(Jeff Atwood) #24

It’s not exactly what I had in mind either but it is definitely better than the old “silently overwrite” behavior, so I guess we can improve it more later?

1 Like

(Bianca) #25

A small follow-up on the edit conflict feature.

Now the edit conflict shows as soon as a draft is saved (every 2 seconds or so).

The other logic (the one that is triggered on submitting the changes) is still there.

https://github.com/discourse/discourse/pull/6585

9 Likes

(Jeff Atwood) #26

Sooo nice! :heart_eyes:

One very small (I hope?) tweak… instead of the :warning: can we show the small avatar of the user who the (most recent, since in theory there could be an infinite number of editing users :scream:) edit conflict is with? My thinking is, this would allow you to ping that person and ask them about their edits?

image

6 Likes

(Stephen) #27

Is it outside the realm of possibility to diff and compare edits in the same way that we compare versions today?

We’re assuming that changes will conflict and work will be lost, but the possibility exists that two editors are making approximately equal changes.

0 Likes

(Régis Hanol) #28

It’s possible but wayyyy more work for not so much added value. We’re just ensuring no work is lost.

0 Likes

(Sam Saffron) #29

It is more work certainly as @zogstrip said but yeah we could diff against the original in both cases and just apply the diff leaving us still to deal with potential merge conflicts.

But I feel this is an optimization for later, not one for today, would far prefer investing in making other aspects of wiki better.

4 Likes

(XP) #40

Just asking, why not make the Wiki a collaborative real-time editor like Google Docs?

0 Likes