mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Don't allow other flag actions after notify_moderator has happened.
https://meta.discourse.org/t/receiving-sorry-an-error-has-occurred-during-flagging-step-of-discobot-tutorial/77233/5
This commit is contained in:
@@ -364,7 +364,7 @@ SQL
|
||||
end
|
||||
|
||||
def is_flag?
|
||||
!!PostActionType.flag_types[post_action_type_id]
|
||||
!!PostActionType.notify_flag_types[post_action_type_id]
|
||||
end
|
||||
|
||||
def is_private_message?
|
||||
@@ -396,7 +396,7 @@ SQL
|
||||
end
|
||||
|
||||
before_create do
|
||||
post_action_type_ids = is_flag? ? PostActionType.flag_types_without_custom.values : post_action_type_id
|
||||
post_action_type_ids = is_flag? ? PostActionType.notify_flag_types.values : post_action_type_id
|
||||
raise AlreadyActed if PostAction.where(user_id: user_id)
|
||||
.where(post_id: post_id)
|
||||
.where(post_action_type_id: post_action_type_ids)
|
||||
|
||||
Reference in New Issue
Block a user