On Wed, Feb 8, 2017 at 3:18 PM, Vincent Massol <vinc...@massol.net> wrote: > Hi Thomas, > >> On 8 Feb 2017, at 14:33, Thomas Mortagne <thomas.morta...@xwiki.com> wrote: >> >> Hi devs, >> >> We have a unintended regression in the standard import: if what you >> import is identical to what is already in the database (including the >> author) it won't add a new version (if you use the default option "Add >> a new version to the existing page"). >> >> What happen in practice is that if you keep calling XWikiDocument#set* >> methods with the same data it won't update the metadata or content >> dirty flags. This flags are what hibernate store look at to know if it >> should add a new version or not. >> >> You can reproduce the same behavior with a simple script which load a >> document, always set the same content and save. You will notice that >> the history of that document does not change. >> >> So the question is do we force metadata dirty to true all the time in >> the instance output filter or do we keep this feature (in which case >> we should optimize it a bit to not do the useless XWiki#saveDocument >> but that's another subject). >> >> WDYT ? >> >> It could be seen as a nice feature but in practice my first reaction >> was WTF and you often want to be sure the import actually did >> something so I'm +1 to force metadata dirty. But I'm +0 to keep the >> current behavior if there is a majority for it. > > It’s hard to decide... > > Same as you, I also thought it was a nice feature when I learnt that this was > what was happening :) >
> Actually something I’ve always wanted was to avoid generating new revisions > when users edit a page and click save without changing any content instead of > clicking cancel (a lot of users do this, generating unnecessary revisions and > when you’re the owner of a wiki, it’s a pain to check the diffs to find out > that there was no changes). But this could be a feature implemented at the > level of the editor save button I guess. It’s a bit different since the > author would be different but we wouldn’t want a save in this case. The reason it does that is because we force it. See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SaveAction.java#L160. > > So I’m +0 for both behaviours with a slight preference toward forcing a rev > to be created. > > Thanks > -Vincent > >> -- >> Thomas Mortagne > -- Thomas Mortagne