diff options
author | Phil Hughes <me@iamphill.com> | 2017-06-15 07:35:41 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-06-15 07:35:41 +0000 |
commit | bfddd9ca06486dce1beb8d8d88466418ddb4be37 (patch) | |
tree | a764c330b6ca91d6e48ec784912fd7e086ec00f3 /app | |
parent | 42aaae9916b7b76da968579fcc722067947df018 (diff) | |
parent | dded02d15c27943975af2577eda70ce7688325a6 (diff) | |
download | gitlab-ce-bfddd9ca06486dce1beb8d8d88466418ddb4be37.tar.gz |
Merge branch '32861-fix-milestone-drag-and-drop-assignees' into 'master'
Fix milestone page assignees when dropped in ongoing list
Closes #32861
See merge request !12076
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/milestone.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/assets/javascripts/milestone.js b/app/assets/javascripts/milestone.js index 841b24a60a3..07ede5ee913 100644 --- a/app/assets/javascripts/milestone.js +++ b/app/assets/javascripts/milestone.js @@ -65,14 +65,18 @@ }; Milestone.successCallback = function(data, element) { - var img_tag; - if (data.assignee) { - img_tag = $('<img/>'); - img_tag.attr('src', data.assignee.avatar_url); - img_tag.addClass('avatar s16'); - $(element).find('.assignee-icon img').replaceWith(img_tag); - } else { - $(element).find('.assignee-icon').empty(); + const $avatarContainer = $(element).find('.assignee-icon'); + $avatarContainer.empty(); + + if (data.assignees && data.assignees.length > 0) { + const $avatars = data.assignees.map((assignee) => { + const img_tag = $('<img/>'); + img_tag.attr('src', assignee.avatar_url); + img_tag.addClass('avatar s16'); + return img_tag; + }); + + $avatarContainer.append($avatars); } }; @@ -161,9 +165,9 @@ data = (function() { switch (newState) { case 'ongoing': - return opts.fieldName + '[assignee_id]=' + gon.current_user_id; + return `${opts.fieldName}[assignee_ids][]=${gon.current_user_id}`; case 'unassigned': - return opts.fieldName + '[assignee_id]='; + return `${opts.fieldName}[assignee_ids][]=0`; case 'closed': return opts.fieldName + '[state_event]=close'; } |