Commit fec70b63 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'project-topics-remove-tag_list' into 'master'

Replace 'tag_list' with 'topic_list' attribute on project

See merge request gitlab-org/gitlab!63493
parents bdd5434c 2ff0b5e3
......@@ -387,6 +387,10 @@ module Types
::Security::CiConfiguration::SastParserService.new(object).configuration
end
def tag_list
object.topic_list
end
private
def project
......
......@@ -15,16 +15,6 @@ module TagsHelper
project_tags_path(@project, @id, options)
end
def tag_list(project)
html = []
project.tag_list.each do |tag|
html << link_to(tag, tag_path(tag))
end
html.join.html_safe
end
def protected_tag?(project, tag)
ProtectedTag.protected?(project, tag.name)
end
......
......@@ -127,10 +127,6 @@ class Project < ApplicationRecord
after_create :check_repository_absence!
acts_as_ordered_taggable_on :topics
# The 'tag_list' alias is required during the 'tags -> topics' migration
# TODO: eliminate 'tag_list' in the further process of the migration
# https://gitlab.com/gitlab-org/gitlab/-/issues/328226
alias_attribute :tag_list, :topic_list
attr_accessor :old_path_with_namespace
attr_accessor :template_name
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Projects > Show > Schema Markup' do
let_it_be(:project) { create(:project, :repository, :public, :with_avatar, description: 'foobar', tag_list: 'tag1, tag2') }
let_it_be(:project) { create(:project, :repository, :public, :with_avatar, description: 'foobar', topic_list: 'topic1, topic2') }
it 'shows SoftwareSourceCode structured markup', :js do
visit project_path(project)
......@@ -16,7 +16,7 @@ RSpec.describe 'Projects > Show > Schema Markup' do
expect(page).to have_selector('[itemprop="identifier"]', text: "Project ID: #{project.id}")
expect(page).to have_selector('[itemprop="description"]', text: project.description)
expect(page).to have_selector('[itemprop="license"]', text: project.repository.license.name)
expect(find_all('[itemprop="keywords"]').map(&:text)).to match_array(project.tag_list.map(&:capitalize))
expect(find_all('[itemprop="keywords"]').map(&:text)).to match_array(project.topic_list.map(&:capitalize))
expect(page).to have_selector('[itemprop="about"]')
end
end
......
......@@ -10,7 +10,7 @@ RSpec.describe Resolvers::ProjectsResolver do
let_it_be(:group) { create(:group, name: 'public-group') }
let_it_be(:private_group) { create(:group, name: 'private-group') }
let_it_be(:project) { create(:project, :public, tag_list: %w(ruby javascript)) }
let_it_be(:project) { create(:project, :public, topic_list: %w(ruby javascript)) }
let_it_be(:other_project) { create(:project, :public) }
let_it_be(:group_project) { create(:project, :public, group: group) }
let_it_be(:private_project) { create(:project, :private) }
......
......@@ -6945,7 +6945,7 @@ RSpec.describe Project, factory_default: :keep do
end
describe 'topics' do
let_it_be(:project) { create(:project, tag_list: 'topic1, topic2, topic3') }
let_it_be(:project) { create(:project, topic_list: 'topic1, topic2, topic3') }
it 'topic_list returns correct string array' do
expect(project.topic_list).to match_array(%w[topic1 topic2 topic3])
......@@ -6955,12 +6955,6 @@ RSpec.describe Project, factory_default: :keep do
expect(project.topics.first.class.name).to eq('ActsAsTaggableOn::Tag')
expect(project.topics.map(&:name)).to match_array(%w[topic1 topic2 topic3])
end
context 'aliases' do
it 'tag_list returns correct string array' do
expect(project.tag_list).to match_array(%w[topic1 topic2 topic3])
end
end
end
shared_examples 'all_runners' do
......
......@@ -65,7 +65,7 @@ RSpec.describe 'getting project information' do
end
it 'includes topics array' do
project.update!(tag_list: 'topic1, topic2, topic3')
project.update!(topic_list: 'topic1, topic2, topic3')
post_graphql(query, current_user: current_user)
......
......@@ -287,9 +287,9 @@ RSpec.describe API::Projects do
expect(json_response.find { |hash| hash['id'] == project.id }.keys).not_to include('open_issues_count')
end
context 'filter by topic (column tag_list)' do
context 'filter by topic (column topic_list)' do
before do
project.update!(tag_list: %w(ruby javascript))
project.update!(topic_list: %w(ruby javascript))
end
it 'returns no projects' do
......@@ -1105,7 +1105,7 @@ RSpec.describe API::Projects do
post api('/projects', user), params: project
expect(json_response['tag_list']).to eq(%w[tagFirst tagSecond])
expect(json_response['topics']).to eq(%w[tagFirst tagSecond])
end
it 'sets topics to a project' do
......@@ -1113,7 +1113,7 @@ RSpec.describe API::Projects do
post api('/projects', user), params: project
expect(json_response['tag_list']).to eq(%w[topic1 topics2])
expect(json_response['topics']).to eq(%w[topic1 topics2])
end
it 'uploads avatar for project a project' do
......@@ -3111,7 +3111,7 @@ RSpec.describe API::Projects do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['tag_list']).to eq(%w[topic1])
expect(json_response['topics']).to eq(%w[topic1])
end
it 'updates topics' do
......@@ -3121,7 +3121,7 @@ RSpec.describe API::Projects do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['tag_list']).to eq(%w[topic2])
expect(json_response['topics']).to eq(%w[topic2])
end
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