diff options
Diffstat (limited to 'app/presenters/project_presenter.rb')
-rw-r--r-- | app/presenters/project_presenter.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 0d038d19af3..80a8ee5cb3c 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -397,16 +397,16 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated end def topics_to_show - project.topic_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord + project_topic_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord end def topics_not_shown - project.topic_list - topics_to_show + project_topic_list - topics_to_show end def count_of_extra_topics_not_shown - if project.topic_list.count > MAX_TOPICS_TO_SHOW - project.topic_list.count - MAX_TOPICS_TO_SHOW + if project_topic_list.count > MAX_TOPICS_TO_SHOW + project_topic_list.count - MAX_TOPICS_TO_SHOW else 0 end @@ -486,6 +486,12 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated **additional_params ) end + + def project_topic_list + strong_memoize(:project_topic_list) do + project.topics.map(&:name) + end + end end ProjectPresenter.prepend_mod_with('ProjectPresenter') |