Merge branch 'pl-user-bot_type-ce' into 'master'
CE Backport: Refactor Service Desk's bot user See merge request gitlab-org/gitlab-ce!26671
This commit is contained in:
commit
f9cf04fe4f
|
@ -537,20 +537,16 @@ class User < ApplicationRecord
|
||||||
username
|
username
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.internal_attributes
|
|
||||||
[:ghost]
|
|
||||||
end
|
|
||||||
|
|
||||||
def internal?
|
def internal?
|
||||||
self.class.internal_attributes.any? { |a| self[a] }
|
ghost?
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.internal
|
def self.internal
|
||||||
where(Hash[internal_attributes.zip([true] * internal_attributes.size)])
|
where(ghost: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.non_internal
|
def self.non_internal
|
||||||
where(internal_attributes.map { |attr| "#{attr} IS NOT TRUE" }.join(" AND "))
|
where('ghost IS NOT TRUE')
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue