Commit 55ce545d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'dz-project-topics-method' into 'master'

Add topics alias to Project#tag_list

See merge request gitlab-org/gitlab!60405
parents d50375e7 90a3eedc
......@@ -129,6 +129,7 @@ class Project < ApplicationRecord
after_create :check_repository_absence!
acts_as_ordered_taggable
alias_method :topics, :tag_list
attr_accessor :old_path_with_namespace
attr_accessor :template_name
......
......@@ -390,16 +390,16 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end
def topics_to_show
project.tag_list.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord
project.topics.take(MAX_TOPICS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord
end
def topics_not_shown
project.tag_list - topics_to_show
project.topics - topics_to_show
end
def count_of_extra_topics_not_shown
if project.tag_list.count > MAX_TOPICS_TO_SHOW
project.tag_list.count - MAX_TOPICS_TO_SHOW
if project.topics.count > MAX_TOPICS_TO_SHOW
project.topics.count - MAX_TOPICS_TO_SHOW
else
0
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment