Project

General

Profile

Feature #27831 » 27831-fixed.patch

Yuichi HARADA, 2020-01-07 02:35

View differences:

app/controllers/repositories_controller.rb
34 34
  before_action :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers]
35 35
  before_action :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
36 36
  before_action :authorize
37
  accept_rss_auth :revisions
37
  accept_rss_auth :revisions, :changes
38 38

  
39 39
  rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
40 40

  
......
104 104
    @entry = @repository.entry(@path, @rev)
105 105
    (show_error_not_found; return) unless @entry
106 106
    @changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
107
    @properties = @repository.properties(@path, @rev)
108 107
    @changeset = @repository.find_changeset_by_name(@rev)
108

  
109
    respond_to do |format|
110
      format.html do
111
        @properties = @repository.properties(@path, @rev)
112
      end
113
      format.atom do
114
        repo_text = @repository.identifier.presence || 'root'
115
        rev_text = @changeset.nil? ? @rev : format_revision(@changeset)
116
        render_feed(@changesets, :title => "#{@project.name}: #{repo_text} @ #{rev_text} - #{l(:label_change_plural)}")
117
      end
118
    end
109 119
  end
110 120

  
111 121
  def revisions
app/views/repositories/changes.html.erb
15 15

  
16 16
<% content_for :header_tags do %>
17 17
<%=   stylesheet_link_tag "scm" %>
18
  <%= auto_discovery_link_tag(
19
               :atom,
20
               :params => request.query_parameters.merge(:key => User.current.rss_key),
21
               :format => 'atom') %>
22
<% end %>
23

  
24
<% other_formats_links do |f| %>
25
  <%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %>
18 26
<% end %>
19 27

  
20 28
<% html_title(l(:label_change_plural)) -%>
config/routes.rb
259 259
        :constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/}
260 260
  end
261 261

  
262
  get "projects/:id/repository/:repository_id/changes(/*path).:format",
263
      :to => 'repositories#changes',
264
      :format => 'atom',
265
      :constraints => {:path => /.*/}
262 266
  %w(browse entry raw changes annotate).each do |action|
263 267
    get "projects/:id/repository/:repository_id/#{action}(/*path)",
264 268
        :controller => 'repositories',
test/integration/routing/repositories_test.rb
83 83
      should_route "GET /projects/foo/repository/svn/diff/#{path}" => "repositories#diff",
84 84
        :id => 'foo', :repository_id => 'svn', :path => path
85 85
    end
86
    @paths.each do |path|
87
      should_route "GET /projects/foo/repository/svn/changes/#{path}.atom" => "repositories#changes",
88
        :id => 'foo', :repository_id => 'svn', :path => path, :format => 'atom'
89
    end
86 90
  end
87 91

  
88 92
  def test_repositories_related_issues_with_repository_id
(4-4/4)