Skip to content
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

Update DefaultPublicationWorkflow.java #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,21 @@ public DocumentReference publish(DocumentReference document) throws XWikiExcepti
+ stringSerializer.serialize(doc.getDocumentReference()) + " to document "
+ stringSerializer.serialize(newDocument.getDocumentReference()), e);
}


// use a fake 3 way merge: previous is toDocument without comments, rights and wf object
// current version is current toDocument
// next version is fromDocument without comments, rights and wf object
XWikiDocument previousDoc = newDocument.clone();
this.cleanUpIrrelevantDataFromDoc(previousDoc, xcontext);
// make sure that the attachments are properly loaded in memory for the duplicate to work fine, otherwise it's a
// bit impredictable about attachments
doc.loadAttachments(xcontext);
XWikiDocument nextDoc = doc.duplicate(newDocument.getDocumentReference());
this.cleanUpIrrelevantDataFromDoc(nextDoc, xcontext);
// and now merge. Normally the attachments which are not in the next doc are deleted from the current doc
MergeResult result = newDocument.merge(previousDoc, nextDoc, new MergeConfiguration(), xcontext);


// published document is visible
newDocument.setHidden(false);
// setup the workflow and target flag, if a workflow doesn't exist already
Expand Down