2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-11 21:04:42 +08:00

UX: include a flag reason in the post-deleted-by-staff-because-of-flags message

This commit is contained in:
Neil Lalonde 2018-07-30 16:45:35 -04:00
parent c12a9279f6
commit fd29ecb91a
3 changed files with 11 additions and 2 deletions

View file

@ -436,8 +436,12 @@ class Post < ActiveRecord::Base
post_actions.where(post_action_type_id: PostActionType.flag_types_without_custom.values, deleted_at: nil).count != 0
end

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 != 0
end

def unhide!

View file

@ -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.

View file

@ -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