mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-02 21:59:39 +00:00
Moves journals selection to Issue#visible_journals_with_index (#17632).
git-svn-id: http://svn.redmine.org/redmine/trunk@16180 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d2fcfc5574
commit
45879a41b2
@ -93,20 +93,15 @@ class IssuesController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@journals = @issue.journals.
|
||||
preload(:details).
|
||||
preload(:user => :email_address).
|
||||
reorder(:created_on, :id).to_a
|
||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||
Journal.preload_journals_details_custom_fields(@journals)
|
||||
@journals.select! {|journal| journal.notes? || journal.visible_details.any?}
|
||||
@journals.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
|
||||
@journals = @issue.visible_journals_with_index
|
||||
@changesets = @issue.changesets.visible.preload(:repository, :user).to_a
|
||||
@changesets.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
|
||||
@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
|
||||
|
||||
if User.current.wants_comments_in_reverse_order?
|
||||
@journals.reverse!
|
||||
@changesets.reverse!
|
||||
end
|
||||
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
@priorities = IssuePriority.active
|
||||
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
|
||||
|
||||
@ -813,6 +813,21 @@ class Issue < ActiveRecord::Base
|
||||
scope
|
||||
end
|
||||
|
||||
# Returns the journals that are visible to user with their index
|
||||
# Used to display the issue history
|
||||
def visible_journals_with_index(user=User.current)
|
||||
result = journals.
|
||||
preload(:details).
|
||||
preload(:user => :email_address).
|
||||
reorder(:created_on, :id).to_a
|
||||
|
||||
result.each_with_index {|j,i| j.indice = i+1}
|
||||
result.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, project)
|
||||
Journal.preload_journals_details_custom_fields(result)
|
||||
result.select! {|journal| journal.notes? || journal.visible_details.any?}
|
||||
result
|
||||
end
|
||||
|
||||
# Returns the initial status of the issue
|
||||
# Returns nil for a new issue
|
||||
def status_was
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user