]> git.openstreetmap.org Git - rails.git/commitdiff
Write the new role in reassign checkbox label
authorAnton Khorev <tony29@yandex.ru>
Wed, 5 Feb 2025 10:00:04 +0000 (13:00 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 5 Feb 2025 10:00:04 +0000 (13:00 +0300)
app/views/issues/_comments.html.erb
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 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"