]> source.dussan.org Git - redmine.git/commitdiff
Show visible spent time link for users allowed to view time entries (#20661).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 29 Jan 2017 10:28:48 +0000 (10:28 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 29 Jan 2017 10:28:48 +0000 (10:28 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@16292 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
app/views/issues/show.html.erb

index 0f66f27fb348d9a6d5fda44039a86ba4c6d2ba0f..efd22108784aad7d6e812f9aa142878d9d96cf9f 100644 (file)
@@ -101,6 +101,11 @@ class IssuesController < ApplicationController
       @changesets.reverse!
     end
 
+    if User.current.allowed_to?(:view_time_entries, @project)
+      Issue.load_visible_spent_hours([@issue])
+      Issue.load_visible_total_spent_hours([@issue])
+    end
+
     respond_to do |format|
       format.html {
         @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
index 9d767f0b11cf3885c808bec573a62b283658ff83..e511247122c2f694366bef0237bbc4c3cd9b3797 100644 (file)
@@ -60,7 +60,7 @@
   unless @issue.disabled_core_fields.include?('estimated_hours')
     rows.right l(:field_estimated_hours), issue_estimated_hours_details(@issue), :class => 'estimated-hours'
   end
-  if User.current.allowed_to_view_all_time_entries?(@project)
+  if User.current.allowed_to?(:view_time_entries, @project)
     if @issue.total_spent_hours > 0
       rows.right l(:label_spent_time), issue_spent_hours_details(@issue), :class => 'spent-time'
     end