Commit 04c199a0 authored by Phil Hughes's avatar Phil Hughes

Fixed bug with sidebar when user is not logged in

parent a1be3241
...@@ -78,7 +78,9 @@ module IssuablesHelper ...@@ -78,7 +78,9 @@ module IssuablesHelper
end end
def has_todo(issuable) def has_todo(issuable)
current_user.todos.find_by(target_id: issuable.id, state: :pending) unless current_user.nil?
current_user.todos.find_by(target_id: issuable.id, state: :pending)
end
end end
private private
......
...@@ -3,18 +3,20 @@ ...@@ -3,18 +3,20 @@
.issuable-sidebar .issuable-sidebar
- can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project) - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
.block.issuable-sidebar-header .block.issuable-sidebar-header
%span.issuable-header-text.hide-collapsed.pull-left - if current_user
Todo %span.issuable-header-text.hide-collapsed.pull-left
Todo
%a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", aria: { label: "Toggle sidebar" } } %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", aria: { label: "Toggle sidebar" } }
= sidebar_gutter_toggle_icon = sidebar_gutter_toggle_icon
%button.btn.btn-default.issuable-header-btn.pull-right.js-issuable-todo{ type: "button", data: { todo_text: "Add Todo", mark_text: "Mark Done", id: (todo.id unless todo.nil?), url: issuable_todo_path(issuable) } } - if current_user
- if todo.nil? %button.btn.btn-default.issuable-header-btn.pull-right.js-issuable-todo{ type: "button", data: { todo_text: "Add Todo", mark_text: "Mark Done", id: (todo.id unless todo.nil?), url: issuable_todo_path(issuable) } }
%span - if todo.nil?
Add Todo %span
- else Add Todo
%span - else
Mark Done %span
= icon('spin spinner', class: 'hidden js-issuable-todo-loading') Mark Done
= icon('spin spinner', class: 'hidden js-issuable-todo-loading')
= form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f| = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f|
.block.assignee .block.assignee
......
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