Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-07-31 16:49:56 +0300
committerStan Hu <stanhu@gmail.com>2019-07-31 16:52:11 +0300
commit3d9c28af9331feb279053113677af2633e4b8e91 (patch)
treefa2c81f63c6a10e32dd0b2787f833889d855cd1f /app/models/note.rb
parentaf9b1ffa75c8bb4e6e80d9d5cd2ad34487c0446c (diff)
Fix first-time contributor notes not rendering
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/note.rb')
-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