Skip to content

Commit

Permalink
Merge pull request #5867 from 4teamwork/pg_teamraum_sources_fullname
Browse files Browse the repository at this point in the history
Remove userid from the users fullname in all teamraum sources.
  • Loading branch information
phgross authored Aug 15, 2019
2 parents c1956d1 + f6eae9b commit c83660a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
------------------------

- Update workflow security for opengever_workspace workflow to fix permission on existing workspaces. [elioschmutz]
- Remove userid from the users fullname in all teamraum sources. [phgross]
- Move task reminders of responsibles to the successor, when accepting a multi admin unit task. [phgross]
- Bump ftw.tabbedview version to 4.1.3 [njohner]

Expand Down
11 changes: 11 additions & 0 deletions opengever/ogds/base/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,17 @@ def _extend_query_with_workspace_filter(self, query):
query = query.filter(sql.false())
return query

def getTerm(self, value):
"""We only need the user fullname as title without the userid in
brackets.
"""
try:
user = self.base_query.filter(User.userid == value).one()
except orm.exc.NoResultFound:
raise LookupError(
'No row was found with userid: {}'.format(value))
return SimpleTerm(value, value, user.fullname())


@implementer(IContextSourceBinder)
class ActualWorkspaceMembersSourceBinder(object):
Expand Down
10 changes: 10 additions & 0 deletions opengever/workspace/tests/test_workspace_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,13 @@ def test_only_users_with_local_roles_with_view_permissions_are_found_by_search(s

results = source.search(self.workspace_guest.id)
self.assertEqual(0, len(results))

def test_title_is_fullname_only(self):
self.login(self.workspace_admin)
source = ActualWorkspaceMembersSource(self.workspace)

term = source.search('beatrice')[0]

self.assertEqual(self.workspace_member.id, term.token)
self.assertEqual(self.workspace_member.id, term.value)
self.assertEqual(u'Schr\xf6dinger B\xe9atrice', term.title)

0 comments on commit c83660a

Please sign in to comment.