From 53ea8a8b8ca15047a83140a7061e700d18295b45 Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sat, 16 Nov 2024 03:56:38 +0000 Subject: [PATCH 1/8] Change devcontainer to Redmine 6.0 --- .devcontainer/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 21a0735..18eab42 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -9,10 +9,10 @@ services: # Update 'VARIANT' to pick a version of Ruby: 3, 3.0, 2, 2.7, 2.6 # Append -bullseye or -buster to pin to an OS version. # Use -bullseye variants on local arm64/Apple Silicon. - RUBY_VERSION: "3.1" + RUBY_VERSION: "3.2" # Optional Node.js version to install NODE_VERSION: "lts/*" - REDMINE_VERSION: "5.1-stable" + REDMINE_VERSION: "6.0-stable" # Overrides default command so things don't shut down after the process ends. command: sleep infinity From 3d1cdc1e94f70778306e9be16fd7e3b1424e11a9 Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sat, 16 Nov 2024 04:03:10 +0000 Subject: [PATCH 2/8] Add Redmine 6.0 to testing environment --- .github/workflows/build.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 263fb34..00651e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,14 +5,31 @@ env: jobs: build: runs-on: ubuntu-latest + # Supported Matrix: + # Redmine 5.0-stable: Ruby 2.7, 3.0, 3.1 + # Redmine 5.1-stable: Ruby 2.7, 3.0, 3.1, 3.2 + # Redmine 6.0-stable: Ruby 3.1, 3.2, 3.3 + # Redmine master: Ruby 3.1, 3.2, 3.3 strategy: matrix: db: [sqlite3, mysql, postgres] - ruby_version: ["2.7", "3.0", "3.1", "3.2"] - redmine_version: [5.0-stable, 5.1-stable, master] + ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"] + redmine_version: [5.0-stable, 5.1-stable, 6.0-stable, master] exclude: - ruby_version: "3.2" redmine_version: 5.0-stable + - ruby_version: "3.3" + redmine_version: 5.0-stable + - ruby_version: "3.3" + redmine_version: 5.1-stable + - ruby_version: "2.7" + redmine_version: 6.0-stable + - ruby_version: "3.0" + redmine_version: 6.0-stable + - ruby_version: "2.7" + redmine_version: master + - ruby_version: "3.0" + redmine_version: master services: mysql: image: mysql:5.7 From f8b8c5976d1468ff3e4c56b83907445c3e384943 Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sat, 16 Nov 2024 04:07:12 +0000 Subject: [PATCH 3/8] remove old i18n function --- app/models/code_review_assignment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/code_review_assignment.rb b/app/models/code_review_assignment.rb index b57e064..4cc2d66 100644 --- a/app/models/code_review_assignment.rb +++ b/app/models/code_review_assignment.rb @@ -53,7 +53,7 @@ def self.create_with_changeset(changeset) assignment = CodeReviewAssignment.new issue = Issue.new issue.subject = auto_assign.subject - issue.subject = l(:code_review_requrest) if issue.subject.blank? + issue.subject = I18n.t(:code_review_requrest) if issue.subject.blank? issue.subject = issue.subject.sub("$REV", changeset.revision) issue.subject = issue.subject.sub("$COMMENTS", changeset.comments.split(//u)[0..60].join) unless changeset.comments.blank? issue.tracker_id = setting.assignment_tracker_id From d984879d9035c73bea620938a08fe4ff89bf14dd Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sat, 16 Nov 2024 04:12:07 +0000 Subject: [PATCH 4/8] drop ruby 2.7 from testing environment --- .github/workflows/build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00651e8..7eaf288 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: db: [sqlite3, mysql, postgres] - ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"] + ruby_version: ["3.0", "3.1", "3.2", "3.3"] redmine_version: [5.0-stable, 5.1-stable, 6.0-stable, master] exclude: - ruby_version: "3.2" @@ -22,12 +22,8 @@ jobs: redmine_version: 5.0-stable - ruby_version: "3.3" redmine_version: 5.1-stable - - ruby_version: "2.7" - redmine_version: 6.0-stable - ruby_version: "3.0" redmine_version: 6.0-stable - - ruby_version: "2.7" - redmine_version: master - ruby_version: "3.0" redmine_version: master services: From 6c7516662073e4aa9e08d2f9f1f498c818c10eb3 Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sat, 16 Nov 2024 08:05:35 +0000 Subject: [PATCH 5/8] fix broken assets path --- app/views/code_review/_html_header.html.erb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/code_review/_html_header.html.erb b/app/views/code_review/_html_header.html.erb index 9e8fbb2..b510872 100644 --- a/app/views/code_review/_html_header.html.erb +++ b/app/views/code_review/_html_header.html.erb @@ -21,11 +21,12 @@ baseurl = Redmine::Utils.relative_url_root -%> - <%= javascript_include_tag(baseurl + "/plugin_assets/redmine_code_review/javascripts/code_review.js") %> - <%= javascript_include_tag(baseurl + '/javascripts/jstoolbar/jstoolbar.js') %> - <%= javascript_include_tag(baseurl + '/javascripts/jstoolbar/textile.js') %> - <%= javascript_include_tag(baseurl + "/javascripts/jstoolbar/lang/jstoolbar-#{@project.current_language.to_s.downcase}.js") %> + <%= javascript_include_tag("code_review.js", plugin: "redmine_code_review") %> + <%= javascript_include_tag('jstoolbar/jstoolbar') %> + <%= javascript_include_tag("jstoolbar/lang/jstoolbar-#{@project.current_language.to_s.downcase}.js") %> + <%= include_calendar_headers_tags %> - <%= stylesheet_link_tag(baseurl + "/plugin_assets/redmine_code_review/stylesheets/code_review.css") %> - <%= stylesheet_link_tag(baseurl + "/stylesheets/jstoolbar.css") %> + <%= stylesheet_link_tag("code_review.css", plugin: "redmine_code_review") %> + <%= stylesheet_link_tag("jstoolbar.css") %> + <% end %> \ No newline at end of file From c5c23961ffb0ae7ffb68f5f844f724db2feb8450 Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sun, 17 Nov 2024 02:21:50 +0000 Subject: [PATCH 6/8] Fix pencil icon is not displayed on Redmine 6. --- assets/javascripts/code_review.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/code_review.js b/assets/javascripts/code_review.js index b4257d4..a0d0650 100644 --- a/assets/javascripts/code_review.js +++ b/assets/javascripts/code_review.js @@ -1,6 +1,6 @@ /* # Code Review plugin for Redmine -# Copyright (C) 2009-2023 Haruyuki Iida +# Copyright (C) 2009- Haruyuki Iida # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -139,6 +139,12 @@ function setAddReviewButton(url, change_id, image_tag, is_readonly, is_diff, att } var line = $(th).data('txt'); + if (line == null || line == "") { + var a = $(th).find('a'); + if (a.length > 0) { + line = $(a).data('txt'); + } + } if (line == null || line == "") { continue; } From c9991336dd17cbcf104bddca4613bc6b462cf3d7 Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sun, 17 Nov 2024 02:29:06 +0000 Subject: [PATCH 7/8] fix undefined method URI.encode --- app/controllers/code_review_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/code_review_controller.rb b/app/controllers/code_review_controller.rb index 3aa10be..cefb7b1 100644 --- a/app/controllers/code_review_controller.rb +++ b/app/controllers/code_review_controller.rb @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CodeReviewController < ApplicationController +class CodeReviewController < ApplicationController before_action :find_project, :authorize, :find_user, :find_setting, :find_repository, :find_priorities helper :sort @@ -251,7 +251,7 @@ def show if action_name == 'attachment' attachment = target.attachment url = url_for(controller: 'attachments', action: 'show', - id: attachment.id) + '/' + URI.encode(attachment.filename) + id: attachment.id) + '/' + URI.encode_www_form_component(attachment.filename) url << '?review_id=' + @review.id.to_s if @review else path = nil if target.diff_all From c6a3742b528289bac1eef46c778c98df1ba30e2c Mon Sep 17 00:00:00 2001 From: Haruyuki Iida Date: Sun, 17 Nov 2024 02:53:11 +0000 Subject: [PATCH 8/8] fix broken i18n label --- app/views/code_review_settings/_show.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/code_review_settings/_show.html.erb b/app/views/code_review_settings/_show.html.erb index 74454d4..fad537c 100644 --- a/app/views/code_review_settings/_show.html.erb +++ b/app/views/code_review_settings/_show.html.erb @@ -1,6 +1,6 @@ <% # Code Review plugin for Redmine -# Copyright (C) 2010-2012 Haruyuki Iida +# Copyright (C) 2010- Haruyuki Iida # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -89,16 +89,16 @@ <%= error_messages_for 'code_review_setting' %>
<%= f.hidden_field :lock_version %> -

<%= f.check_box :tracker_in_review_dialog %>

+

<%= f.check_box :tracker_in_review_dialog, label: t(:field_tracker_in_review_dialog) %>

<%=h l(:select_tracker_for_code_reviews)%>: -

<%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %>

+

<%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true, label: t(:field_tracker) %>

<%=h l(:select_tracker_for_code_review_assignment)%>: -

<%= f.select :assignment_tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %>

+

<%= f.select :assignment_tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true, label: t(:field_assignment_tracker) %>

- <%= f.check_box :hide_code_review_tab %> + <%= f.check_box :hide_code_review_tab, label: t(:field_hide_code_review_tab) %>