Skip to content

Commit

Permalink
Merge pull request #47 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Dec 5, 2024
2 parents 6456019 + e418126 commit 37a3b64
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

6.0 - (2024-12-05)
---------------------------
* Change: Fix plone.app.vocabularies.Users to work with Creators and Contributors Field
[avoinea - refs #274362]
* Fix: Context Navigation title becoming undefined on Edit when deleting a manually added title
[ichim-david - refs #280463]

5.8 - (2024-11-26)
---------------------------
* Feature: added getObjSize info for File portal_type used to get file size information
Expand Down
5 changes: 5 additions & 0 deletions eea/volto/policy/overrides.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
permission="zope.Public" />
</configure>

<utility
factory=".vocabularies.principals.UsersFactory"
name="plone.app.vocabularies.Users"
/>

</configure>
7 changes: 7 additions & 0 deletions eea/volto/policy/restapi/services/contextnavigation/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ def render(self):

return res

def title(self):
""" title """
# Allow to have empty title without Navigation fallback
name = self.data.name
# handle bug where empty title is set to undefined from Volto
return name if name != "undefined" else self.data.title

def recurse(self, children, level, bottomLevel):
"""Recurse through the navigation tree"""
res = []
Expand Down
2 changes: 1 addition & 1 deletion eea/volto/policy/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8
6.0
33 changes: 33 additions & 0 deletions eea/volto/policy/vocabularies/principals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
""" Vocabulary for users.
"""
from plone import api
from plone.app.vocabularies.principals import UsersFactory as BaseUsersFactory
from plone.app.vocabularies.principals import PrincipalsVocabulary
from zope.schema.vocabulary import SimpleTerm
from zope.component.hooks import getSite
from Products.CMFCore.utils import getToolByName


class UsersFactory(BaseUsersFactory):
""" Factory creating a UsersVocabulary
"""
@property
def items(self):
"""Return a list of users"""
if not self.should_search(query=""):
return
acl_users = getToolByName(getSite(), "acl_users")
userids = set(u.get('id') for u in acl_users.searchUsers())
for userid in userids:
user = api.user.get(userid)
if not user:
continue
fullname = user.getProperty("fullname", "")
if not fullname:
continue
yield SimpleTerm(userid, userid, fullname)

def __call__(self, *args, **kwargs):
vocabulary = PrincipalsVocabulary(list(self.items))
vocabulary.principal_source = self.source
return vocabulary
Empty file added principals.py
Empty file.

0 comments on commit 37a3b64

Please sign in to comment.