Patch #38432 ยป 0001-not-need-issue-to-show-diff.patch
app/controllers/journals_controller.rb | ||
---|---|---|
45 | 45 |
end |
46 | 46 | |
47 | 47 |
def diff |
48 |
@issue = @journal.issue |
|
49 | 48 |
if params[:detail_id].present? |
50 | 49 |
@detail = @journal.details.find_by_id(params[:detail_id]) |
51 | 50 |
else |
52 | 51 |
@detail = @journal.details.detect {|d| d.property == 'attr' && d.prop_key == 'description'} |
53 | 52 |
end |
54 |
unless @issue && @detail
|
|
53 |
unless @journal.journalized && @detail
|
|
55 | 54 |
render_404 |
56 | 55 |
return false |
57 | 56 |
end |
58 | 57 |
if @detail.property == 'cf' |
59 |
unless @detail.custom_field && @detail.custom_field.visible_by?(@issue.project, User.current)
|
|
58 |
unless @detail.custom_field && @detail.custom_field.visible_by?(@project, User.current) |
|
60 | 59 |
raise ::Unauthorized |
61 | 60 |
end |
62 | 61 |
end |
... | ... | |
107 | 106 |
private |
108 | 107 | |
109 | 108 |
def find_journal |
110 |
@journal = Journal.visible.find(params[:id])
|
|
109 |
@journal = Journal.find(params[:id]) |
|
111 | 110 |
@project = @journal.journalized.project |
111 |
unless User.current.allowed_to?(:view_private_notes, @project) || @journal.journalized.visible_by?(@project, User.current) |
|
112 |
raise ::Unauthorized |
|
113 |
end |
|
112 | 114 |
rescue ActiveRecord::RecordNotFound |
113 | 115 |
render_404 |
114 | 116 |
end |
app/views/journals/diff.html.erb | ||
---|---|---|
1 |
<h2><%= @issue.tracker %> #<%= @issue.id %></h2>
|
|
1 |
<h2><%= @journal.journalized.to_s %></h2>
|
|
2 | 2 |
<p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p> |
3 | 3 | |
4 | 4 |
<pre class="text-diff"><%= @diff.to_html %></pre> |
5 | 5 | |
6 |
<p> |
|
7 |
<%= link_to(l(:button_back), issue_path(@issue), |
|
8 |
:onclick => 'if (document.referrer != "") {history.back(); return false;}') %> |
|
9 |
</p> |
|
6 |
<p><a href="javascript:history.back()"><%= l(:button_back) %></a></p> |
|
10 | 7 | |
11 |
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
8 |
<% html_title @journal.journalized.to_s %> |