summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-07-31 06:49:56 -0700
committerStan Hu <stanhu@gmail.com>2019-07-31 06:52:11 -0700
commit3d9c28af9331feb279053113677af2633e4b8e91 (patch)
treefa2c81f63c6a10e32dd0b2787f833889d855cd1f /app/models
parentaf9b1ffa75c8bb4e6e80d9d5cd2ad34487c0446c (diff)
downloadgitlab-ce-3d9c28af9331feb279053113677af2633e4b8e91.tar.gz
Fix first-time contributor notes not renderingsh-fix-special-role-error-500
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31117 enabled the HashInefficientHash Rubocop rule that was fooled by the special implementation of `SpecialRole`. We fix this by introducing a `value?` method and adding unit tests. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65383
Diffstat (limited to 'app/models')
-rw-r--r--app/models/note.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 3f182c1f099..a12d1eb7243 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -27,6 +27,10 @@ class Note < ApplicationRecord
def values
constants.map {|const| self.const_get(const)}
end
+
+ def value?(val)
+ values.include?(val)
+ end
end
end