Commit ae7a4397 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'rj-fix-manual-order' into 'master'

Don't let logged out user do manual order

See merge request gitlab-org/gitlab-ce!30264
parents 4a8fa7fa 2302385c
...@@ -21,7 +21,7 @@ const updateIssue = (url, issueList, { move_before_id, move_after_id }) => ...@@ -21,7 +21,7 @@ const updateIssue = (url, issueList, { move_before_id, move_after_id }) =>
const initManualOrdering = () => { const initManualOrdering = () => {
const issueList = document.querySelector('.manual-ordering'); const issueList = document.querySelector('.manual-ordering');
if (!issueList || !(gon.features && gon.features.manualSorting)) { if (!issueList || !(gon.features && gon.features.manualSorting) || !(gon.current_user_id > 0)) {
return; return;
} }
......
---
title: Don't let logged out user do manual order
merge_request: 30264
author:
type: fixed
...@@ -150,6 +150,25 @@ describe 'Group issues page' do ...@@ -150,6 +150,25 @@ describe 'Group issues page' do
check_issue_order check_issue_order
end end
it 'issues should not be draggable when user is not logged in', :js do
sign_out(user_in_group)
visit issues_group_path(group, sort: 'relative_position')
drag_to(selector: '.manual-ordering',
from_index: 0,
to_index: 2)
wait_for_requests
# Issue order should remain the same
page.within('.manual-ordering') do
expect(find('.issue:nth-child(1) .title')).to have_content('Issue #1')
expect(find('.issue:nth-child(2) .title')).to have_content('Issue #2')
expect(find('.issue:nth-child(3) .title')).to have_content('Issue #3')
end
end
def check_issue_order def check_issue_order
page.within('.manual-ordering') do page.within('.manual-ordering') do
expect(find('.issue:nth-child(1) .title')).to have_content('Issue #2') expect(find('.issue:nth-child(1) .title')).to have_content('Issue #2')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment