FEATURE: Bulk topic tagging allowing restricted operations on sole categories (#26602)

The bulk actions menu for topics has multiple options to work
with tags on topics (append, replace, remove). Our tagging system
along with categories allows for some complicated tag restrictions
to be applied via tag groups. This was a problem for the topic bulk
actions because you couldn't append restricted tags to topics.

This commit allows restricted tags to be used in bulk tagging actions
as long as all selected topics are for a sole category. The category
information will be shown in the modal, and the category ID is used
for the tag search.
This commit is contained in:
Martin Brennan
2024-04-12 13:10:14 +10:00
committed by GitHub
parent a96367e56a
commit 973a0028b4
9 changed files with 266 additions and 53 deletions

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
module PageObjects
module Components
class CategoryBadge < PageObjects::Components::Base
SELECTOR = ".badge-category__wrapper"
def find_for_category(category)
find(category_selector(category))
end
def category_selector(category)
"#{SELECTOR} .badge-category[data-category-id='#{category.id}']"
end
end
end
end

View File

@ -75,12 +75,12 @@ module PageObjects
find("#topic-entrance button.jump-top").native.send_keys(:return)
end
private
def topic_list_item_class(topic)
"#{TOPIC_LIST_ITEM_SELECTOR}[data-topic-id='#{topic.id}']"
end
private
def topic_list_item_closed(topic)
"#{topic_list_item_class(topic)} .topic-statuses .topic-status svg.locked"
end

View File

@ -30,6 +30,12 @@ module PageObjects
).click
end
def click_bulk_button(name)
find(bulk_select_dropdown_item(name)).click
end
# TODO (martin) Remove all this once discourse-assign is using the new bulk select
# modal page object in specs.
def has_close_topics_button?
page.has_css?(bulk_select_dropdown_item("close-topics"))
end
@ -57,6 +63,7 @@ module PageObjects
def click_dismiss_read_confirm
find("#dismiss-read-confirm").click
end
### /TODO
private