mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
don't treat notify user as a flag
This commit is contained in:
parent
034513f0fa
commit
2bdb53261b
4 changed files with 25 additions and 15 deletions
|
@ -43,7 +43,12 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||
this.set('acted', true);
|
||||
this.set('count', this.get('count') + 1);
|
||||
this.set('can_act', false);
|
||||
this.set('can_undo', action !== 'notify_moderators' && action !== 'notify_user');
|
||||
this.set('can_undo', true);
|
||||
|
||||
if(action === 'notify_moderators' || action=='notify_user') {
|
||||
this.set('can_undo',false);
|
||||
this.set('can_clear_flags',false);
|
||||
}
|
||||
|
||||
// Add ourselves to the users who liked it if present
|
||||
if (this.present('users')) {
|
||||
|
|
|
@ -21,7 +21,7 @@ join (
|
|||
limit 100
|
||||
"
|
||||
|
||||
sql.where2 "post_action_type_id in (:flag_types)", flag_types: PostActionType.flag_types.values
|
||||
sql.where2 "post_action_type_id in (:flag_types)", flag_types: PostActionType.notify_flag_types.values
|
||||
|
||||
|
||||
# it may make sense to add a view that shows flags on deleted posts,
|
||||
|
@ -62,7 +62,7 @@ limit 100
|
|||
from post_actions a
|
||||
/*where*/
|
||||
"
|
||||
sql.where("post_action_type_id in (:flag_types)", flag_types: PostActionType.flag_types.values)
|
||||
sql.where("post_action_type_id in (:flag_types)", flag_types: PostActionType.notify_flag_types.values)
|
||||
sql.where("post_id in (:posts)", posts: posts.map{|p| p["id"].to_i})
|
||||
|
||||
if params[:filter] == 'old'
|
||||
|
|
|
@ -20,7 +20,7 @@ class PostAction < ActiveRecord::Base
|
|||
|
||||
def self.update_flagged_posts_count
|
||||
posts_flagged_count = PostAction.joins(post: :topic)
|
||||
.where('post_actions.post_action_type_id' => PostActionType.flag_types.values,
|
||||
.where('post_actions.post_action_type_id' => PostActionType.notify_flag_types.values,
|
||||
'posts.deleted_at' => nil,
|
||||
'topics.deleted_at' => nil).count('DISTINCT posts.id')
|
||||
|
||||
|
@ -169,11 +169,11 @@ class PostAction < ActiveRecord::Base
|
|||
Topic.update_all ["#{column} = #{column} + ?", delta], id: post.topic_id
|
||||
|
||||
|
||||
if PostActionType.flag_types.values.include?(post_action_type_id)
|
||||
if PostActionType.notify_flag_types.values.include?(post_action_type_id)
|
||||
PostAction.update_flagged_posts_count
|
||||
end
|
||||
|
||||
if SiteSetting.flags_required_to_hide_post > 0
|
||||
if PostActionType.auto_action_flag_types.include?(post_action_type) && SiteSetting.flags_required_to_hide_post > 0
|
||||
# automatic hiding of posts
|
||||
flag_counts = exec_sql("SELECT SUM(CASE WHEN deleted_at IS NULL THEN 1 ELSE 0 END) AS new_flags,
|
||||
SUM(CASE WHEN deleted_at IS NOT NULL THEN 1 ELSE 0 END) AS old_flags
|
||||
|
|
|
@ -21,6 +21,11 @@ class PostActionType < ActiveRecord::Base
|
|||
@flag_types ||= types.only(:off_topic, :spam, :inappropriate, :notify_user, :notify_moderators)
|
||||
end
|
||||
|
||||
# flags resulting in mod notifications
|
||||
def notify_flag_types
|
||||
@notify_flag_types ||= types.only(:off_topic, :spam, :inappropriate, :notify_moderators)
|
||||
end
|
||||
|
||||
def is_flag?(sym)
|
||||
flag_types.valid?(sym)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue