mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-20 20:11:19 -04:00
don't run the wrong sentinel on message, message is validated in the post, in effect some flags were being rejected incorrectly
This commit is contained in:
parent
40c9014634
commit
4512956c68
2 changed files with 1 additions and 9 deletions
|
@ -15,8 +15,6 @@ class PostAction < ActiveRecord::Base
|
|||
|
||||
rate_limit :post_action_rate_limiter
|
||||
|
||||
validate :message_quality
|
||||
|
||||
scope :spam_flags, -> { where(post_action_type_id: PostActionType.types[:spam]) }
|
||||
|
||||
def self.update_flagged_posts_count
|
||||
|
@ -183,12 +181,6 @@ class PostAction < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def message_quality
|
||||
return if message.blank?
|
||||
sentinel = TextSentinel.title_sentinel(message)
|
||||
errors.add(:message, I18n.t(:is_invalid)) unless sentinel.valid?
|
||||
end
|
||||
|
||||
before_create do
|
||||
post_action_type_ids = is_flag? ? PostActionType.flag_types.values : post_action_type_id
|
||||
raise AlreadyActed if PostAction.where(user_id: user_id,
|
||||
|
|
|
@ -15,7 +15,7 @@ describe PostAction do
|
|||
describe "flagged_posts_report" do
|
||||
it "operates correctly" do
|
||||
PostAction.act(codinghorror, post, PostActionType.types[:spam])
|
||||
mod_message = PostAction.act(Fabricate(:user), post, PostActionType.types[:notify_moderators], message: "this post really sucks a lot I hate it")
|
||||
mod_message = PostAction.act(Fabricate(:user), post, PostActionType.types[:notify_moderators], message: "this is a 10")
|
||||
|
||||
posts, users = PostAction.flagged_posts_report("")
|
||||
posts.count.should == 1
|
||||
|
|
Loading…
Reference in a new issue