diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-11-14 15:28:23 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-11-14 15:28:23 +0000 |
commit | e7e748a1fd09033d822cc0f58b1a334b725985c8 (patch) | |
tree | 7da46b1750beca6ada5f3bfa8d82b66d726e475e | |
parent | 7f151a7898bf6b836ba7ae0b53d718a1263b5d6f (diff) | |
parent | b16780f76671ba704bfc4ee75d1f555b4dfc3035 (diff) | |
download | gitlab-ce-24457-cannot-delete-labels.tar.gz |
Merge branch 'issue-boards-signed-out-state' into 'master'
24457-cannot-delete-labels
Fixed issue boards when not logged in
## What does this MR do?
This managed to get through because their wasn't actually any tests for loading the lists when a user is not logged in. This fixes that by adding a test & also fixing the template not correctly compiling under VueJS v2.
See merge request !7452
7 files changed, 10 insertions, 6 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index adbca510ef7..4a4017003d8 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -266,7 +266,7 @@ class Issue < ActiveRecord::Base def as_json(options = {}) super(options).tap do |json| - json[:subscribed] = subscribed?(options[:user]) if options.has_key?(:user) + json[:subscribed] = subscribed?(options[:user]) if options.has_key?(:user) && options[:user] if options.has_key?(:labels) json[:labels] = labels.as_json( diff --git a/app/views/projects/boards/components/_sidebar.html.haml b/app/views/projects/boards/components/_sidebar.html.haml index f0c0c6953e0..2125c3387c4 100644 --- a/app/views/projects/boards/components/_sidebar.html.haml +++ b/app/views/projects/boards/components/_sidebar.html.haml @@ -1,5 +1,5 @@ %board-sidebar{ "inline-template" => true, - ":current-user" => "#{current_user.to_json(only: [:username, :id, :name], methods: [:avatar_url]) if current_user}" } + ":current-user" => "#{current_user ? current_user.to_json(only: [:username, :id, :name], methods: [:avatar_url]) : {}}" } %aside.right-sidebar.right-sidebar-expanded.issue-boards-sidebar{ "v-show" => "showSidebar" } .issuable-sidebar .block.issuable-sidebar-header diff --git a/app/views/projects/boards/components/sidebar/_assignee.html.haml b/app/views/projects/boards/components/sidebar/_assignee.html.haml index 604e13858d1..8fe1b832071 100644 --- a/app/views/projects/boards/components/sidebar/_assignee.html.haml +++ b/app/views/projects/boards/components/sidebar/_assignee.html.haml @@ -1,8 +1,8 @@ .block.assignee .title.hide-collapsed Assignee - = icon("spinner spin", class: "block-loading") - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") = link_to "Edit", "#", class: "edit-link pull-right" .value.hide-collapsed %span.assign-yourself.no-value{ "v-if" => "!issue.assignee" } diff --git a/app/views/projects/boards/components/sidebar/_due_date.html.haml b/app/views/projects/boards/components/sidebar/_due_date.html.haml index c7da1d0d4ac..1a3b88e28c5 100644 --- a/app/views/projects/boards/components/sidebar/_due_date.html.haml +++ b/app/views/projects/boards/components/sidebar/_due_date.html.haml @@ -1,8 +1,8 @@ .block.due_date .title Due date - = icon("spinner spin", class: "block-loading") - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") = link_to "Edit", "#", class: "edit-link pull-right" .value .value-content diff --git a/app/views/projects/boards/components/sidebar/_labels.html.haml b/app/views/projects/boards/components/sidebar/_labels.html.haml index ce68e5e1998..0f0a84c156d 100644 --- a/app/views/projects/boards/components/sidebar/_labels.html.haml +++ b/app/views/projects/boards/components/sidebar/_labels.html.haml @@ -1,8 +1,8 @@ .block.labels .title Labels - = icon("spinner spin", class: "block-loading") - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") = link_to "Edit", "#", class: "edit-link pull-right" .value.issuable-show-labels %span.no-value{ "v-if" => "issue.labels && issue.labels.length === 0" } diff --git a/app/views/projects/boards/components/sidebar/_milestone.html.haml b/app/views/projects/boards/components/sidebar/_milestone.html.haml index 3cd20d1c0f7..008d1186478 100644 --- a/app/views/projects/boards/components/sidebar/_milestone.html.haml +++ b/app/views/projects/boards/components/sidebar/_milestone.html.haml @@ -1,8 +1,8 @@ .block.milestone .title Milestone - = icon("spinner spin", class: "block-loading") - if can?(current_user, :admin_issue, @project) + = icon("spinner spin", class: "block-loading") = link_to "Edit", "#", class: "edit-link pull-right" .value %span.no-value{ "v-if" => "!issue.milestone" } diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 6cb8753e8fc..4aa84fb65d9 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -659,6 +659,10 @@ describe 'Issue Boards', feature: true, js: true do wait_for_vue_resource end + it 'displays lists' do + expect(page).to have_selector('.board') + end + it 'does not show create new list' do expect(page).not_to have_selector('.js-new-board-list') end |