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,7 +57,7 @@ if defined? RedmineClient | ||
57 | def url_to_file(file_path, line_number = nil) | 57 | def url_to_file(file_path, line_number = nil) |
58 | # alt_project_id let's users specify a different project for tickets / app files. | 58 | # alt_project_id let's users specify a different project for tickets / app files. |
59 | project = self.alt_project_id.present? ? self.alt_project_id : self.project_id | 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 | line_number ? url << "#L#{line_number}" : url | 61 | line_number ? url << "#L#{line_number}" : url |
62 | end | 62 | end |
63 | 63 |
spec/models/issue_trackers/redmine_tracker_spec.rb
@@ -30,9 +30,9 @@ describe IssueTrackers::RedmineTracker do | @@ -30,9 +30,9 @@ describe IssueTrackers::RedmineTracker do | ||
30 | it "should generate a url where a file with line number can be viewed" do | 30 | it "should generate a url where a file with line number can be viewed" do |
31 | t = Fabricate(:redmine_tracker, :account => 'http://redmine.example.com', :project_id => "errbit") | 31 | t = Fabricate(:redmine_tracker, :account => 'http://redmine.example.com', :project_id => "errbit") |
32 | expect(t.url_to_file("/example/file")). | 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 | expect(t.url_to_file("/example/file", 25)). | 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 | end | 36 | end |
37 | 37 | ||
38 | it "should use the alt_project_id to generate a file/linenumber url, if given" do | 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,6 +40,6 @@ describe IssueTrackers::RedmineTracker do | ||
40 | :project_id => "errbit", | 40 | :project_id => "errbit", |
41 | :alt_project_id => "actual_project") | 41 | :alt_project_id => "actual_project") |
42 | expect(t.url_to_file("/example/file", 25)). | 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 | end | 44 | end |
45 | end | 45 | end |