]> git.openstreetmap.org Git - rails.git/commitdiff
Merge pull request #5559 from hlfan/eslint-plugin-erb
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 5 Feb 2025 17:07:50 +0000 (17:07 +0000)
committerGitHub <noreply@github.com>
Wed, 5 Feb 2025 17:07:50 +0000 (17:07 +0000)
Add eslint-plugin-erb to provide linting of .js.erb files

app/views/issues/_comments.html.erb
config/eslint.js
config/locales/en.yml
test/system/issues_test.rb

index f828e5a4350b4a80bb64306190aa85ecc4cd18bd..d7005d75eb7571fcc1f6e2d20bc7f22d681c0115 100644 (file)
@@ -21,7 +21,8 @@
   <%= bootstrap_form_for @new_comment, :url => issue_comments_path(@issue) do |f| %>
     <%= f.richtext_field :body, :cols => 80, :rows => 20, :hide_label => true %>
     <%= f.form_group do %>
-      <%= f.check_box :reassign, { :label => t(".reassign_param"), :id => "reassign", :name => "reassign", :checked => false }, true, false %>
+      <%= f.check_box :reassign, { :label => @issue.assigned_role == "administrator" ? t(".reassign_to_moderators") : t(".reassign_to_administrators"),
+                                   :id => "reassign", :name => "reassign", :checked => false }, true, false %>
     <% end %>
     <%= f.primary %>
   <% end %>
index b99179d27a4b200e7c9337e171cf33314d781551..7cbb9575f39a468295bca251f76b33d4a4574f5d 100644 (file)
@@ -21,7 +21,6 @@ module.exports = [
         L: "readonly",
         OSM: "writable",
         Matomo: "readonly",
-        Qs: "readonly",
         Turbo: "readonly",
         updateLinks: "readonly"
       }
index 40b4bfa142997eaa20c2eabba88093012d753dee..25794cc9fde873a5d041605d5f2db5efa7bf005a 100644 (file)
@@ -1551,7 +1551,8 @@ en:
       reopened: Issue status has been set to 'Open'
     comments:
       comment_from_html: "Comment from %{user_link} on %{comment_created_at}"
-      reassign_param: Reassign Issue?
+      reassign_to_moderators: Reassign Issue to Moderators
+      reassign_to_administrators: Reassign Issue to Administrators
     reports:
       reported_by_html: "Reported as %{category} by %{user} on %{updated_at}"
     helper:
index a961ea80f7a54099597920e2073c0055a573cad9..e26ae89ac6556cbec289f25e52ed445ac98e33b6 100644 (file)
@@ -114,15 +114,15 @@ class IssuesTest < ApplicationSystemTestCase
     assert_equal("test comment", issue.comments.first.body)
   end
 
-  def test_reassign_issue
-    issue = create(:issue)
-    assert_equal "administrator", issue.assigned_role
+  def test_reassign_issue_to_moderators
+    issue = create(:issue, :assigned_role => "administrator")
     sign_in_as(create(:administrator_user))
 
     visit issue_path(issue)
 
+    assert_unchecked_field "Reassign Issue to Moderators"
     fill_in :issue_comment_body, :with => "reassigning to moderators"
-    check :reassign
+    check "Reassign Issue to Moderators"
     click_on "Add Comment"
 
     assert_content "and the issue was reassigned"
@@ -132,6 +132,24 @@ class IssuesTest < ApplicationSystemTestCase
     assert_equal "moderator", issue.assigned_role
   end
 
+  def test_reassign_issue_to_administrators
+    issue = create(:issue, :assigned_role => "moderator")
+    sign_in_as(create(:moderator_user))
+
+    visit issue_path(issue)
+
+    assert_unchecked_field "Reassign Issue to Administrators"
+    fill_in :issue_comment_body, :with => "reassigning to administrators"
+    check "Reassign Issue to Administrators"
+    click_on "Add Comment"
+
+    assert_content "and the issue was reassigned"
+    assert_current_path issues_path(:status => "open")
+
+    issue.reload
+    assert_equal "administrator", issue.assigned_role
+  end
+
   def test_reassign_issue_as_super_user
     issue = create(:issue)
     sign_in_as(create(:super_user))
@@ -139,7 +157,7 @@ class IssuesTest < ApplicationSystemTestCase
     visit issue_path(issue)
 
     fill_in :issue_comment_body, :with => "reassigning to moderators"
-    check :reassign
+    check "Reassign Issue to Moderators"
     click_on "Add Comment"
 
     assert_content "and the issue was reassigned"