mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-17 08:36:06 +10:00
Merge branch 'issuable-sidebar-dropdown-deselect-fix' into 'master'
Fixed issue with de-selecting dropdown option in issue sidebar ## What does this MR do? When de-selecting either an assignee or milestone, we try to send `undefined` which jQuery removes from the request causing a routing error. Instead this MR sends `null` which jQuery still sends and then correctly removes either the milestone or assignee. ## What are the relevant issue numbers? Closes #18641 ## Screenshots (if relevant)  ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - [ ] Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !4671
This commit is contained in:
@@ -116,7 +116,7 @@ class @MilestoneSelect
|
||||
.val()
|
||||
data = {}
|
||||
data[abilityName] = {}
|
||||
data[abilityName].milestone_id = selected
|
||||
data[abilityName].milestone_id = if selected? then selected else null
|
||||
$loading
|
||||
.fadeIn()
|
||||
$dropdown.trigger('loading.gl.dropdown')
|
||||
|
||||
@@ -31,7 +31,7 @@ class @UsersSelect
|
||||
assignTo = (selected) ->
|
||||
data = {}
|
||||
data[abilityName] = {}
|
||||
data[abilityName].assignee_id = selected
|
||||
data[abilityName].assignee_id = if selected? then selected else null
|
||||
$loading
|
||||
.fadeIn()
|
||||
$dropdown.trigger('loading.gl.dropdown')
|
||||
|
||||
@@ -396,6 +396,27 @@ describe 'Issues', feature: true do
|
||||
expect(page).to have_content @user.name
|
||||
end
|
||||
end
|
||||
|
||||
it 'allows user to unselect themselves', js: true do
|
||||
issue2 = create(:issue, project: project, author: @user)
|
||||
visit namespace_project_issue_path(project.namespace, project, issue2)
|
||||
|
||||
page.within '.assignee' do
|
||||
click_link 'Edit'
|
||||
click_link @user.name
|
||||
|
||||
page.within '.value' do
|
||||
expect(page).to have_content @user.name
|
||||
end
|
||||
|
||||
click_link 'Edit'
|
||||
click_link @user.name
|
||||
|
||||
page.within '.value' do
|
||||
expect(page).to have_content "No assignee"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'by unauthorized user' do
|
||||
@@ -440,6 +461,26 @@ describe 'Issues', feature: true do
|
||||
|
||||
expect(issue.reload.milestone).to be_nil
|
||||
end
|
||||
|
||||
it 'allows user to de-select milestone', js: true do
|
||||
visit namespace_project_issue_path(project.namespace, project, issue)
|
||||
|
||||
page.within('.milestone') do
|
||||
click_link 'Edit'
|
||||
click_link milestone.title
|
||||
|
||||
page.within '.value' do
|
||||
expect(page).to have_content milestone.title
|
||||
end
|
||||
|
||||
click_link 'Edit'
|
||||
click_link milestone.title
|
||||
|
||||
page.within '.value' do
|
||||
expect(page).to have_content 'None'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'by unauthorized user' do
|
||||
|
||||
Reference in New Issue
Block a user