mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 22:59:57 +08:00
don't treat notify user as a flag
This commit is contained in:
parent
034513f0fa
commit
2bdb53261b
@ -43,7 +43,12 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||||||
this.set('acted', true);
|
this.set('acted', true);
|
||||||
this.set('count', this.get('count') + 1);
|
this.set('count', this.get('count') + 1);
|
||||||
this.set('can_act', false);
|
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
|
// Add ourselves to the users who liked it if present
|
||||||
if (this.present('users')) {
|
if (this.present('users')) {
|
||||||
|
@ -21,7 +21,7 @@ join (
|
|||||||
limit 100
|
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,
|
# it may make sense to add a view that shows flags on deleted posts,
|
||||||
@ -62,7 +62,7 @@ limit 100
|
|||||||
from post_actions a
|
from post_actions a
|
||||||
/*where*/
|
/*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})
|
sql.where("post_id in (:posts)", posts: posts.map{|p| p["id"].to_i})
|
||||||
|
|
||||||
if params[:filter] == 'old'
|
if params[:filter] == 'old'
|
||||||
|
@ -20,7 +20,7 @@ class PostAction < ActiveRecord::Base
|
|||||||
|
|
||||||
def self.update_flagged_posts_count
|
def self.update_flagged_posts_count
|
||||||
posts_flagged_count = PostAction.joins(post: :topic)
|
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,
|
'posts.deleted_at' => nil,
|
||||||
'topics.deleted_at' => nil).count('DISTINCT posts.id')
|
'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
|
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
|
PostAction.update_flagged_posts_count
|
||||||
end
|
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
|
# automatic hiding of posts
|
||||||
flag_counts = exec_sql("SELECT SUM(CASE WHEN deleted_at IS NULL THEN 1 ELSE 0 END) AS new_flags,
|
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
|
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)
|
@flag_types ||= types.only(:off_topic, :spam, :inappropriate, :notify_user, :notify_moderators)
|
||||||
end
|
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)
|
def is_flag?(sym)
|
||||||
flag_types.valid?(sym)
|
flag_types.valid?(sym)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user