FEATURE: webhook for flag events

This commit is contained in:
Arpit Jalan
2018-04-11 19:47:05 +05:30
parent 7ff78cc013
commit a16b616861
9 changed files with 116 additions and 0 deletions

View File

@@ -155,6 +155,7 @@ SQL
DiscourseEvent.trigger(:confirmed_spam_post, post) if trigger_spam
DiscourseEvent.trigger(:flag_reviewed, post)
DiscourseEvent.trigger(:flag_agreed, actions.first) if actions.first.present?
update_flagged_posts_count
end
@@ -188,6 +189,7 @@ SQL
Post.with_deleted.where(id: post.id).update_all(cached)
DiscourseEvent.trigger(:flag_reviewed, post)
DiscourseEvent.trigger(:flag_disagreed, actions.first) if actions.first.present?
update_flagged_posts_count
end
@@ -206,6 +208,7 @@ SQL
end
DiscourseEvent.trigger(:flag_reviewed, post)
DiscourseEvent.trigger(:flag_deferred, actions.first) if actions.first.present?
update_flagged_posts_count
end
@@ -306,6 +309,10 @@ SQL
end
end
if post_action && PostActionType.notify_flag_type_ids.include?(post_action_type_id)
DiscourseEvent.trigger(:flag_created, post_action)
end
GivenDailyLike.increment_for(user.id) if post_action_type_id == PostActionType.types[:like]
# agree with other flags