mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
Revert "Revert "FEATURE: Can create warnings for users via PM""
This reverts commit 1c7559380c145136726028ae9f2aeea6f351eb78.
This commit is contained in:
@ -35,6 +35,7 @@ class User < ActiveRecord::Base
|
||||
has_many :invites, dependent: :destroy
|
||||
has_many :topic_links, dependent: :destroy
|
||||
has_many :uploads
|
||||
has_many :warnings
|
||||
|
||||
has_one :user_avatar, dependent: :destroy
|
||||
has_one :facebook_user_info, dependent: :destroy
|
||||
@ -393,6 +394,10 @@ class User < ActiveRecord::Base
|
||||
PostAction.where(user_id: id, post_action_type_id: PostActionType.flag_types.values).count
|
||||
end
|
||||
|
||||
def warnings_received_count
|
||||
warnings.count
|
||||
end
|
||||
|
||||
def flags_received_count
|
||||
posts.includes(:post_actions).where('post_actions.post_action_type_id' => PostActionType.flag_types.values).count
|
||||
end
|
||||
|
Reference in New Issue
Block a user