Skip to content

Commit

Permalink
jira: Use username for user lists
Browse files Browse the repository at this point in the history
Since we don't support user list manipulation by using
lists of email addresses yet, present user names instead
of email addresses (note: username _may_ also be an email
address in Jira) when rendering lists of users.

For assignee and fields that are single users, we do
support assigning by email address since we search Jira
for the username.
  • Loading branch information
lhh committed Jan 22, 2024
1 parent 36ae8cd commit 587b0cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion jirate/jira_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def user(field, fields):


def user_list(field, fields):
return _list_of_key(field, 'emailAddress')
# Until we take email addresses as input, we should use
# user names only when presenting lists of users
return _list_of_key(field, 'name')


def array(field, fields):
Expand Down
4 changes: 2 additions & 2 deletions jirate/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@
{'name': 'Option2', 'value': 'option_two'}],
'customfield_1234570': [{'name': 'Version1', 'value': 'version_one'},
{'name': 'Version2', 'value': 'version_two'}],
'customfield_1234571': [{'key': 'user1', 'displayName': 'One', 'emailAddress': '[email protected]'},
{'key': 'user2', 'displayName': 'Two', 'emailAddress': '[email protected]'}],
'customfield_1234571': [{'key': 'user1', 'name': 'user-one', 'displayName': 'One', 'emailAddress': '[email protected]'},
{'key': 'user2', 'name': '[email protected]', 'displayName': 'Two', 'emailAddress': '[email protected]'}],
'customfield_1234572': ['one', 'two', 'three'],
'customfield_1234573': [{'name': 'group1'}, {'name': 'group2'}],
'customfield_1234574': ['one', 2.0],
Expand Down
5 changes: 3 additions & 2 deletions jirate/tests/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ def test_render_code_override():
# Array of Versions (names),
pytest.param('customfield_1234570', 'Array of Versions', 'Version1, Version2'),

# Array of Users (email addresses),
pytest.param('customfield_1234571', 'Array of Users', '[email protected], [email protected]'),
# Array of Users (user names),
# TODO: Support setting arrays of users by email address
pytest.param('customfield_1234571', 'Array of Users', 'user-one, [email protected]'),

# Array of strings
pytest.param('customfield_1234572', 'Array of Strings', 'one, two, three'),
Expand Down

0 comments on commit 587b0cd

Please sign in to comment.