summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-03-07 19:06:13 -0800
committerhttp://jneen.net/ <jneen@jneen.net>2017-03-09 12:02:49 -0800
commitef4ba8d3ce32d4e8af34ac86b64e5cf7a85ed926 (patch)
treed50dca2d85e6462fb6e21b7ca50ea709a22b6cd3 /app
parentb88314f4ad955897dc737b6e9515b43dc9d97422 (diff)
downloadgitlab-ce-ef4ba8d3ce32d4e8af34ac86b64e5cf7a85ed926.tar.gz
add .internal and .non_internal scopes
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 520baf6e659..1081f103ea6 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -354,8 +354,20 @@ class User < ActiveRecord::Base
end
end
+ def self.internal_attributes
+ [:ghost]
+ end
+
def internal?
- ghost?
+ self.class.internal_attributes.any? { |a| self[a] }
+ end
+
+ def self.internal
+ where(Hash[internal_attributes.zip([true] * internal_attributes.size)])
+ end
+
+ def self.non_internal
+ where(Hash[internal_attributes.zip([false] * internal_attributes.size)])
end
#