Project

General

Profile

Actions

Defect #32449

closed

Diff view for .js files in repositories is broken

Added by terrell smith over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
SCM
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

When viewing a commit in the repository for a non-javascript file, clicking the diff link for that file opens the diff in the "view differences" tab on the same page.

When viewing a javascript file with a .js extension, clicking the diff link opens the snippet that would normally go in the "view differences" as a new page with no styling.

This is happening on our install across projects and consistently for all javascript files. Clicking on the "view differences" table for the javascript files instead of the diff link does display normally. It is easy to work around, by just using the show differences tab instead of the diff link.

Environment:
Redmine version 4.0.5.stable
Ruby version 2.6.3-p62 (2019-04-16) [x86_64-linux]
Rails version 5.2.3
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Git 2.17.1


Files

defect.32449-redmine_3.4.4.png (59.9 KB) defect.32449-redmine_3.4.4.png No error in 3.4.4 Guillermo ML, 2020-02-19 10:33
defect.32449-redmine_4.0.4.png (50.5 KB) defect.32449-redmine_4.0.4.png Neither styles nor menu in 4.0.4 Guillermo ML, 2020-02-19 10:33

Related issues

Related to Redmine - Defect #30850: Unified diff link broken on specific file/revision diff viewClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #37626: Diff of a javascript file in repository module is not displayed with layout ClosedMarius BÄ‚LTEANU

Actions
Actions #2

Updated by Go MAEDA about 4 years ago

  • Status changed from New to Confirmed
Actions #3

Updated by Guillermo ML about 4 years ago

Same with our Mercurial SCM.

version 3.4.4.stable --> works fine

No error in 3.4.4

version 4.0.4.stable --> no styles and the menu disappears

Neither styles nor menu in 4.0.4

Actions #4

Updated by Mizuki ISHIKAWA about 4 years ago

When displaying the js file, base.html.erb was not used as the layout file.
Specifying an explicit layout file as shown below should solve the problem.

diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 269bc70a0..8350b4d48 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -269,7 +269,7 @@ class RepositoriesController < ApplicationController
       @changeset = @repository.find_changeset_by_name(@rev)
       @changeset_to = @rev_to ? @repository.find_changeset_by_name(@rev_to) : nil
       @diff_format_revisions = @repository.diff_format_revisions(@changeset, @changeset_to)
-      render :diff, :formats => :html
+      render :diff, :formats => :html, :layout => 'base.html.erb'
     end
   end
Actions #5

Updated by Go MAEDA about 4 years ago

  • Related to Defect #30850: Unified diff link broken on specific file/revision diff view added
Actions #6

Updated by Guillermo ML about 4 years ago

After applying Mizuki ISHIKAWA's change and restarting Redmine, View differences page works flawlessly with .js files.

Actions #7

Updated by Go MAEDA about 4 years ago

  • Target version set to 4.0.7

Setting the target version to 4.0.7.

Actions #8

Updated by Go MAEDA about 4 years ago

  • Subject changed from diff display issue for js files in git to Diff view for .js files in repositories is broken
Actions #9

Updated by Go MAEDA about 4 years ago

  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you all for reporting and fixing this issue.

Actions #10

Updated by Go MAEDA over 1 year ago

  • Related to Defect #37626: Diff of a javascript file in repository module is not displayed with layout added
Actions

Also available in: Atom PDF