Commit 08be2b2ebbd071d51a848964c08cf47dac5bce79
Committed by
Arthur Neves
1 parent
121531ca
Exists in
master
and in
1 other branch
Fix Redmine repository links
Previously the link would point to the revision overview, where the line number in the urlmakes no sense. Now it shows the file a t the proper line. One can still switch to the changes from there with one click.
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
app/models/issue_trackers/redmine_tracker.rb
... | ... | @@ -57,7 +57,7 @@ if defined? RedmineClient |
57 | 57 | def url_to_file(file_path, line_number = nil) |
58 | 58 | # alt_project_id let's users specify a different project for tickets / app files. |
59 | 59 | project = self.alt_project_id.present? ? self.alt_project_id : self.project_id |
60 | - url = "#{self.account.gsub(/\/$/, '')}/projects/#{project}/repository/revisions/#{app.repository_branch}/changes/#{file_path.sub(/\[PROJECT_ROOT\]/, '').sub(/^\//,'')}" | |
60 | + url = "#{self.account.gsub(/\/$/, '')}/projects/#{project}/repository/revisions/#{app.repository_branch}/entry/#{file_path.sub(/\[PROJECT_ROOT\]/, '').sub(/^\//,'')}" | |
61 | 61 | line_number ? url << "#L#{line_number}" : url |
62 | 62 | end |
63 | 63 | ... | ... |
spec/models/issue_trackers/redmine_tracker_spec.rb
... | ... | @@ -30,9 +30,9 @@ describe IssueTrackers::RedmineTracker do |
30 | 30 | it "should generate a url where a file with line number can be viewed" do |
31 | 31 | t = Fabricate(:redmine_tracker, :account => 'http://redmine.example.com', :project_id => "errbit") |
32 | 32 | expect(t.url_to_file("/example/file")). |
33 | - to eq 'http://redmine.example.com/projects/errbit/repository/revisions/master/changes/example/file' | |
33 | + to eq 'http://redmine.example.com/projects/errbit/repository/revisions/master/entry/example/file' | |
34 | 34 | expect(t.url_to_file("/example/file", 25)). |
35 | - to eq 'http://redmine.example.com/projects/errbit/repository/revisions/master/changes/example/file#L25' | |
35 | + to eq 'http://redmine.example.com/projects/errbit/repository/revisions/master/entry/example/file#L25' | |
36 | 36 | end |
37 | 37 | |
38 | 38 | it "should use the alt_project_id to generate a file/linenumber url, if given" do |
... | ... | @@ -40,6 +40,6 @@ describe IssueTrackers::RedmineTracker do |
40 | 40 | :project_id => "errbit", |
41 | 41 | :alt_project_id => "actual_project") |
42 | 42 | expect(t.url_to_file("/example/file", 25)). |
43 | - to eq 'http://redmine.example.com/projects/actual_project/repository/revisions/master/changes/example/file#L25' | |
43 | + to eq 'http://redmine.example.com/projects/actual_project/repository/revisions/master/entry/example/file#L25' | |
44 | 44 | end |
45 | 45 | end | ... | ... |