Skip to content

Proposal: Clean attachments as current user instead of last author of the diagram #395

@JackTaylor1114

Description

@JackTaylor1114

Currently, when saving a diagram, the existing .png and .svg image attachments are deleted and then new images are attached to prevent versioning of these attachments. The deletion of attachments in DiagramResourcesImpl.deleteAttachments() clones the document, removes the attachment and then saves the document. This results in a new revision with the last user that saved the document as the author and causes confusing entries in the recent activty feed of that user.

Proposal: Deleting the attachments should be done as the user that is currently saving the diagram.
Could look like this:

UserReference currentUser = userReferenceResolver.resolve(context.getUserReference());
clonedDiagramDocument.getAuthors().setEffectiveMetadataAuthor(currentUser);
clonedDiagramDocument.getAuthors().setOriginalMetadataAuthor(currentUser);
xwiki.saveDocument(clonedDiagramDocument, "Clean old diagram attachments", false, context);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions