A platform for community discussion. Free, open, simple.
UX: include a flag reason in the post-deleted-by-staff-because-of-flags message
Neil Lalondefd29ecb91abc
diff --git a/app/models/post.rb b/app/models/post.rbindex a98cd178077..6953169c56b 100644--- a/app/models/post.rb+++ b/app/models/post.rb@@ -436,8 +436,12 @@ class Post < ActiveRecord::Basepost_actions.where(post_action_type_id: PostActionType.flag_types_without_custom.values, deleted_at: nil).count != 0end+ def active_flags+ post_actions.active.where(post_action_type_id: PostActionType.flag_types_without_custom.values)+ end+def has_active_flag?- post_actions.active.where(post_action_type_id: PostActionType.flag_types_without_custom.values).count != 0+ active_flags.count != 0enddef unhide!diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 8c85dc3f750..ae2ed3a40da 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -2253,6 +2253,8 @@ en:<%{base_url}%{url}>+ %{flag_reason}+This post was flagged by the community and a staff member opted to remove it.Please review our [community guidelines](%{base_url}/guidelines) for details.diff --git a/lib/post_destroyer.rb b/lib/post_destroyer.rbindex 33c316007a4..ff808b418f6 100644--- a/lib/post_destroyer.rb+++ b/lib/post_destroyer.rb@@ -201,7 +201,10 @@ class PostDestroyer:send_system_message,user_id: @post.user.id,message_type: :flags_agreed_and_post_deleted,- message_options: { url: @post.url }+ message_options: {+ url: @post.url,+ flag_reason: I18n.t("flag_reasons.#{@post.active_flags.last.post_action_type.name_key}", locale: SiteSetting.default_locale)+ })end