Skip to content

Commit

Permalink
Merge pull request #217 from collective/fix-versions-principal
Browse files Browse the repository at this point in the history
Fix editing revision author
  • Loading branch information
pbauer authored Sep 29, 2023
2 parents a12fa66 + 5c1780f commit a056fc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog

- Don't re-use `mapping` variable when migrating portlet data.
[witsch]
- Fix editing revision author - refs #216
[avoinea]

- Better support for portal import which avoids parsing JSON twice.
[gotcha]
Expand Down
4 changes: 4 additions & 0 deletions src/collective/exportimport/export_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,12 @@ def export_revisions(self, item, obj):
comment = history_metadata.retrieve(version_id)["metadata"]["sys_metadata"]["comment"]
if comment and comment != item["exportimport.versions"][version_id].get("changeNote"):
item["exportimport.versions"][version_id]["changeNote"] = comment
principal = history_metadata.retrieve(version_id)["metadata"]["sys_metadata"]["principal"]
if principal and principal != item["exportimport.versions"][version_id].get("changeActor"):
item["exportimport.versions"][version_id]["changeActor"] = principal
# current changenote
item["changeNote"] = history_metadata.retrieve(-1)["metadata"]["sys_metadata"]["comment"]
item["changeActor"] = history_metadata.retrieve(-1)["metadata"]["sys_metadata"]["principal"]
return item


Expand Down
1 change: 1 addition & 0 deletions src/collective/exportimport/import_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ def save_revision(self, obj, item, initial=False):
"comment": comment,
"timestamp": timestamp,
"originator": None,
"principal": item.get("changeActor"),
}
rt._recursiveSave(
obj, app_metadata={}, sys_metadata=sys_metadata, autoapply=True
Expand Down

0 comments on commit a056fc2

Please sign in to comment.