fix(jira): use assignee.name or assignee.displayName

On *.atlassian.com hosts the api returns the name on 'displayName'

The jira API doesn't seem to send the field name anymore
https://docs.atlassian.com/software/jira/docs/api/7.1.0/com/atlassian/jira/user/UserDetails.html

After this commit we use one or the other, whatever is available.
This commit is contained in:
David Grajal 2021-09-13 10:45:08 +02:00
parent 3b24474de4
commit 7ed2f25012
No known key found for this signature in database
GPG Key ID: 3894F60EB7B8C049
1 changed files with 11 additions and 2 deletions

View File

@ -167,13 +167,22 @@ local function worker(user_args)
local cur_status = ''
for _, issue in ipairs(result.issues) do
local path_to_avatar = HOME_DIR ..'/.cache/awmw/jira-widget/avatars/' .. issue.fields.assignee.name
local path_to_avatar = HOME_DIR ..'/.cache/awmw/jira-widget/avatars/' .. issue.fields.assignee.name or issue.fields.assignee.displayName
local name = ''
if issue.fields.assignee.name == nil then
name = issue.fields.assignee.displayName
else
name = issue.fields.assignee.name
end
local path_to_avatar = HOME_DIR ..'/.cache/awmw/jira-widget/avatars/' .. name
if not gfs.file_readable(path_to_avatar) then
spawn.easy_async(string.format(
DOWNLOAD_AVATAR_CMD,
HOME_DIR,
issue.fields.assignee.name,
name,
issue.fields.assignee.avatarUrls['48x48']))
end