Patch #38432 ยป 0001-not-need-issue-to-show-diff.patch
| app/controllers/journals_controller.rb | ||
|---|---|---|
|
end
|
||
|
def diff
|
||
|
@issue = @journal.issue
|
||
|
if params[:detail_id].present?
|
||
|
@detail = @journal.details.find_by_id(params[:detail_id])
|
||
|
else
|
||
|
@detail = @journal.details.detect {|d| d.property == 'attr' && d.prop_key == 'description'}
|
||
|
end
|
||
|
unless @issue && @detail
|
||
|
unless @journal.journalized && @detail
|
||
|
render_404
|
||
|
return false
|
||
|
end
|
||
|
if @detail.property == 'cf'
|
||
|
unless @detail.custom_field && @detail.custom_field.visible_by?(@issue.project, User.current)
|
||
|
unless @detail.custom_field && @detail.custom_field.visible_by?(@project, User.current)
|
||
|
raise ::Unauthorized
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
private
|
||
|
def find_journal
|
||
|
@journal = Journal.visible.find(params[:id])
|
||
|
@journal = Journal.find(params[:id])
|
||
|
@project = @journal.journalized.project
|
||
|
unless User.current.allowed_to?(:view_private_notes, @project) || @journal.journalized.visible_by?(@project, User.current)
|
||
|
raise ::Unauthorized
|
||
|
end
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
end
|
||
| app/views/journals/diff.html.erb | ||
|---|---|---|
|
<h2><%= @issue.tracker %> #<%= @issue.id %></h2>
|
||
|
<h2><%= @journal.journalized.to_s %></h2>
|
||
|
<p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p>
|
||
|
<pre class="text-diff"><%= @diff.to_html %></pre>
|
||
|
<p>
|
||
|
<%= link_to(l(:button_back), issue_path(@issue),
|
||
|
:onclick => 'if (document.referrer != "") {history.back(); return false;}') %>
|
||
|
</p>
|
||
|
<p><a href="javascript:history.back()"><%= l(:button_back) %></a></p>
|
||
|
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
|
||
|
<% html_title @journal.journalized.to_s %>
|
||