Project

General

Profile

Actions

Defect #37626

closed

Diff of a javascript file in repository module is not displayed with layout

Added by Trang Tran Thi Quynh over 1 year ago. Updated over 1 year ago.

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

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

At repository, when viewing differences of a javascript file, the revision page is showed with no styling as the image below

By the log content, no errors occurred. But I think request format JS is a mistake.

About my application's environment
Redmine 5
Ruby version              ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
RubyGems version          3.3.7
Rails version             6.1.6
Active Record version     6.1.6
Action Pack version       6.1.6
Action Mailer version     6.1.6
Active Support version    6.1.6
Application root          /opt/redmine
Environment               production
Database adapter          mysql
Database schema version   5.5.41

Files

error-1.png (151 KB) error-1.png Trang Tran Thi Quynh, 2022-08-31 12:22
error-2.png (17.9 KB) error-2.png Trang Tran Thi Quynh, 2022-08-31 12:22

Related issues

Related to Redmine - Defect #32449: Diff view for .js files in repositories is brokenClosedGo MAEDA

Actions
Related to Redmine - Defect #34984: Rails 6.1 Rendering actions with '.' in the name is deprecatedClosedGo MAEDA

Actions
Related to Redmine - Defect #37732: Fix "DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated" in RepositoriesControllerClosedMarius BĂLTEANU

Actions
Copied to Redmine - Defect #39747: Diff of a javascript file in repository module is not displayed with layout ClosedMarius BĂLTEANU

Actions
Actions #1

Updated by Trang Tran Thi Quynh over 1 year ago

This bug was reported at https://www.redmine.org/issues/32449 and fixed. But it occurred again after fixed for Rails 6.1 Rendering actions with '.' in the name is deprecated #34984.

/app/controllers/repositories_controller.rb
-  render :diff, :formats => :html, :layout => 'base.html.erb'
+  render :diff, :formats => :html, :layout => 'base'
Actions #2

Updated by Go MAEDA over 1 year ago

  • Category changed from Rails support to SCM
  • Status changed from New to Confirmed
Actions #3

Updated by Go MAEDA over 1 year ago

  • Related to Defect #32449: Diff view for .js files in repositories is broken added
Actions #4

Updated by Go MAEDA over 1 year ago

  • Related to Defect #34984: Rails 6.1 Rendering actions with '.' in the name is deprecated added
Actions #5

Updated by Mizuki ISHIKAWA over 1 year ago

Rewriting to base.html.erb as before should solve the problem.
When displaying a diff of the js file, it appears to look for base.js if I don't explicitly write it.

diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index ff1230c883..56be9d526a 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -286,7 +286,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, :layout => 'base'
+      render :diff, :formats => :html, :layout => 'base.html.erb'
     end
   end

Actions #6

Updated by Go MAEDA over 1 year ago

Mizuki ISHIKAWA wrote:

Rewriting to base.html.erb as before should solve the problem.
When displaying a diff of the js file, it appears to look for base.js if I don't explicitly write it.

[...]

The patch fixes the issue but causes deprecation warnings.

DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: layouts/base.html.erb (called from block in find_all at /Users/maeda/redmines/redmine-trunk/config/initializers/10-patches.rb:60)
  Rendering layout layouts/base.html.erb
  Rendering repositories/diff.html.erb within layouts/base.html.erb
Actions #7

Updated by Go MAEDA over 1 year ago

  • Target version set to Candidate for next minor release

Go MAEDA wrote:

The patch fixes the issue but causes deprecation warnings.

But I think we should prioritize fixing the problem when viewing JavaScript files than fixing deprecation warnings.

Actions #8

Updated by Marius BĂLTEANU over 1 year ago

  • Target version changed from Candidate for next minor release to 5.0.3
Actions #9

Updated by Marius BĂLTEANU over 1 year ago

  • Subject changed from At repository, viewing differences of a javascript file is lost style to Diff of a javascript file in repository module is not displayed with layout
  • Assignee set to Marius BĂLTEANU
Actions #10

Updated by Marius BĂLTEANU over 1 year ago

  • Status changed from Confirmed to Resolved
  • Resolution set to Fixed

I tried to add a functional test for this case, but without success, I think because the request made by minitest is different by the one made by the browser.

In the meantime, I've merged the proposed fix to 5.0-stable and I've opened a new issue (#37732) to properly fix this issue.

Actions #11

Updated by Marius BĂLTEANU over 1 year ago

  • Status changed from Resolved to Closed
Actions #12

Updated by Go MAEDA over 1 year ago

  • Related to Defect #37732: Fix "DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated" in RepositoriesController added
Actions #13

Updated by Marius BĂLTEANU 4 months ago

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

Also available in: Atom PDF