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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 12:07:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 12:07:45 +0300
commitb11f7057d067885619ee3e513751f180b2e8ad85 (patch)
treedfb3077ea8716ed217f5ce4324be4e25a450c599 /app/models/label.rb
parente50050a8756a20b6aa118edbad3369674e4c63ba (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index d9c5fe0bb39..652b5e23490 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -159,6 +159,11 @@ class Label < ApplicationRecord
on_project_boards(project_id).where(id: label_id).exists?
end
+ # Generate a hex color based on hex-encoded value
+ def self.color_for(value)
+ "##{Digest::MD5.hexdigest(value)[0..5]}"
+ end
+
def open_issues_count(user = nil)
issues_count(user, state: 'opened')
end