diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-31 15:08:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-31 15:08:50 +0000 |
commit | ccab6fb4df8bc12220334618e56d911c4d0e447c (patch) | |
tree | a8c7bb66fb4c36c97e7e1b4f27744fcd93c3bcf3 /app/models/work_item.rb | |
parent | 820c5f6d5c816ba4b742f2ae2e08cc548314531a (diff) | |
download | gitlab-ce-ccab6fb4df8bc12220334618e56d911c4d0e447c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/work_item.rb')
-rw-r--r-- | app/models/work_item.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/work_item.rb b/app/models/work_item.rb index a70f0957fa9..10476339ca9 100644 --- a/app/models/work_item.rb +++ b/app/models/work_item.rb @@ -67,6 +67,16 @@ class WorkItem < Issue end end + # Returns widget object if available + # type parameter can be a symbol, for example, `:description`. + def get_widget(type) + widgets.find do |widget| + widget.instance_of?(WorkItems::Widgets.const_get(type.to_s.camelize, false)) + end + rescue NameError + nil + end + def ancestors hierarchy.ancestors(hierarchy_order: :asc) end |