Skip to content

Commit

Permalink
Merge pull request #151 from plone/2.2.x-backport-addcreators-fix
Browse files Browse the repository at this point in the history
Backport addCreator fix from master - refs #150
  • Loading branch information
jensens authored May 26, 2021
2 parents 0abce2a + 67f1e30 commit 9e7991d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/150.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addCreator should not add if a creator is already set for content. This prevents every editor on content from adding to the list of creators for an object. [avoinea, vangheem]
4 changes: 4 additions & 0 deletions plone/dexterity/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ def notifyModified(self):
@security.protected(permissions.ModifyPortalContent)
def addCreator(self, creator=None):
# Add creator to Dublin Core creators.
if len(self.creators) > 0:
# do not add creator if one is already set
return

if creator is None:
user = getSecurityManager().getUser()
creator = user and user.getId()
Expand Down

0 comments on commit 9e7991d

Please sign in to comment.