diff --git a/app/javascript/src/javascripts/user_feedback.js b/app/javascript/src/javascripts/user_feedback.js deleted file mode 100644 index 881f57020..000000000 --- a/app/javascript/src/javascripts/user_feedback.js +++ /dev/null @@ -1,10 +0,0 @@ -$(() => { - $("#c-user-feedbacks #negative-policy").hide(); - $("#c-user-feedbacks #user_feedback_category").on("change.danbooru", (e) => { - if (e.target.value === "negative") { - $("#c-user-feedbacks #negative-policy").show(); - } else { - $("#c-user-feedbacks #negative-policy").hide(); - } - }); -}); diff --git a/app/models/user_feedback.rb b/app/models/user_feedback.rb index 404c027e8..17c3611e6 100644 --- a/app/models/user_feedback.rb +++ b/app/models/user_feedback.rb @@ -40,16 +40,13 @@ class UserFeedback < ApplicationRecord self.user = User.find_by_name(name) end - def disclaimer - if category != "negative" - return nil + def create_dmail + body = %{@#{creator.name} created a "#{category} record":#{Routes.user_feedbacks_path(search: { user_id: user_id })} for your account:\n\n#{self.body}} + + if category == "negative" + body += "\n\n---\n\nA negative feedback is a record on your account that you've engaged in negative or rule-breaking behavior. You can appeal this feedback if you think it's unfair by petitioning the mods and admins in the forum. Negative feedback generally doesn't affect your usability of the site, but serious or repeated infractions may lead to a ban." end - "The purpose of feedback is to help you become a valuable member of the site by highlighting adverse behaviors. The author, #{creator.name}, should have sent you a message in the recent past as a warning. The fact that you're receiving this feedback now implies you've ignored their advice.\n\nYou can protest this feedback by petitioning the mods and admins in the forum. If #{creator.name} fails to provide sufficient evidence, you can have the feedback removed. However, if you fail to defend yourself against the accusations, you will likely earn yourself another negative feedback.\n\nNegative feedback generally doesn't affect your usability of the site. But it does mean other users may trust you less and give you less benefit of the doubt.\n\n" - end - - def create_dmail - body = %{#{disclaimer}@#{creator.name} created a "#{category} record":#{Routes.user_feedbacks_path(search: { user_id: user_id })} for your account:\n\n#{self.body}} Dmail.create_automated(:to_id => user_id, :title => "Your user record has been updated", :body => body) end diff --git a/app/views/user_feedbacks/new.html.erb b/app/views/user_feedbacks/new.html.erb index 079e78516..1988a1554 100644 --- a/app/views/user_feedbacks/new.html.erb +++ b/app/views/user_feedbacks/new.html.erb @@ -2,10 +2,15 @@

New User Feedback

-
-

Before submitting negative feedback, you must make a good faith effort at communicating with the user (through DMails) to tell them what they are doing wrong. It is unfair to drop a negative record on them without warning. If you have not done this with at least two weeks of notice, the user can dispute the feedback and have it removed. You will need to provide evidence that your feedback is accurate and you gave advanced warning, so you should collect any relevant links and include them in your feedback.

+
+

Before giving a user negative feedback, you must communicate with them privately first to tell them what + they're doing wrong and how to improve. A negative feedback should only be given after they've been warned first, + unless the user is deliberately breaking the <%= link_to_wiki "site rules", "help:community rules" %>, such as engaging + in intentional vandalism or ban evasion.

-

Please consult <%= link_to_wiki "the guide", "help:user_records" %> for advice on how to write constructive feedback.

+

A neutral feedback can be given for less serious offenses, or as an initial warning before giving a negative.

+ +

Please consult <%= link_to_wiki "help:user records" %> for more information on giving user feedbacks.

diff --git a/test/functional/user_feedbacks_controller_test.rb b/test/functional/user_feedbacks_controller_test.rb index 2f57c0f50..e16b4d95a 100644 --- a/test/functional/user_feedbacks_controller_test.rb +++ b/test/functional/user_feedbacks_controller_test.rb @@ -79,9 +79,23 @@ class UserFeedbacksControllerTest < ActionDispatch::IntegrationTest end context "create action" do - should "allow gold users to create new feedbacks" do + should "allow gold users to create positive feedbacks" do assert_difference("UserFeedback.count", 1) do - post_auth user_feedbacks_path, @critic, params: {:user_feedback => {:category => "positive", :user_name => @user.name, :body => "xxx"}} + post_auth user_feedbacks_path, @critic, params: { user_feedback: { category: "positive", user_name: @user.name, body: "xxx" }} + assert_response :redirect + end + end + + should "allow gold users to create neutral feedbacks" do + assert_difference("UserFeedback.count", 1) do + post_auth user_feedbacks_path, @critic, params: { user_feedback: { category: "positive", user_name: @user.name, body: "xxx" }} + assert_response :redirect + end + end + + should "allow gold users to create negative feedbacks" do + assert_difference("UserFeedback.count", 1) do + post_auth user_feedbacks_path, @critic, params: { user_feedback: { category: "negative", user_name: @user.name, body: "xxx" }} assert_response :redirect end end