A platform for community discussion. Free, open, simple.
FIX: Normalize tag-chooser tags to names in RSS polling and chat archive (#41654)
Régis Hanold1a27693cffb
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjsindex 603750a565e..5c55b2bed14 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/archive-channel.gjs@@ -86,7 +86,9 @@ export default class ChatModalArchiveChannel extends Component {if (this.newTopic) {data.title = this.topicTitle;data.category_id = this.categoryId;- data.tags = this.tags;+ data.tags = (this.tags ?? []).map((tag) =>+ typeof tag === "string" ? tag : tag.name+ );}if (this.existingTopic) {data.topic_id = this.selectedTopicId;diff --git a/plugins/chat/spec/system/archive_channel_spec.rb b/plugins/chat/spec/system/archive_channel_spec.rbindex 14f5c9f101a..3a306de9219 100644--- a/plugins/chat/spec/system/archive_channel_spec.rb+++ b/plugins/chat/spec/system/archive_channel_spec.rb@@ -54,14 +54,29 @@ RSpec.describe "Archive channel" docontext "when archiving" doit "works" do+ SiteSetting.tagging_enabled = true+ tag = Fabricate(:tag, name: "archived")Jobs.run_immediately!chat.visit_channel_settings(channel_1)click_button(I18n.t("js.chat.channel_settings.archive_channel"))find("#split-topic-name").fill_in(with: "An interesting topic for cats")++ tag_chooser =+ PageObjects::Components::SelectKit.new(".chat-to-topic-selector .tag-chooser")+ tag_chooser.expand+ tag_chooser.search(tag.name)+ tag_chooser.select_row_by_name(tag.name)+ tag_chooser.collapse+click_button(I18n.t("js.chat.channel_archive.title"))expect(page).to have_css(".chat-channel-archive-status", wait: 15)++ try_until_success do+ archive = Chat::ChannelArchive.find_by(chat_channel: channel_1)+ expect(archive&.destination_tags).to eq([tag.name])+ endendcontext "when archived channels had unreads" dodiff --git a/plugins/discourse-rss-polling/admin/assets/javascripts/discourse/components/rss-polling-feed-form.gjs b/plugins/discourse-rss-polling/admin/assets/javascripts/discourse/components/rss-polling-feed-form.gjsindex 0e2eb71f14c..97a0e1029d7 100644--- a/plugins/discourse-rss-polling/admin/assets/javascripts/discourse/components/rss-polling-feed-form.gjs+++ b/plugins/discourse-rss-polling/admin/assets/javascripts/discourse/components/rss-polling-feed-form.gjs@@ -169,7 +169,9 @@ export default class RssPollingFeedForm extends Component {});}- const feedTags = data.discourse_tags ?? [];+ const feedTags = (data.discourse_tags ?? []).map((tag) =>+ typeof tag === "string" ? tag : tag.name+ );this.categoryRequirements.forEach((group) => {const matched = group.tags.filter((tag) => feedTags.includes(tag)).length;diff --git a/plugins/discourse-rss-polling/spec/system/admin_spec.rb b/plugins/discourse-rss-polling/spec/system/admin_spec.rbindex e1164ce48c7..850f3294bee 100644--- a/plugins/discourse-rss-polling/spec/system/admin_spec.rb+++ b/plugins/discourse-rss-polling/spec/system/admin_spec.rb@@ -15,6 +15,9 @@ RSpec.describe "Rss Polling - admin" doit "tests a feed and saves the configuration" dostub_request(:get, url).to_return(status: 200, body: file_from_fixtures("feed.rss", "feed"))+ tag_group = Fabricate(:tag_group, tags: [tag_1])+ CategoryRequiredTagGroup.create!(category: category_1, tag_group:, min_count: 1)+visit("/admin/plugins/discourse-rss-polling/feeds")find(".rss-polling-feeds__add").click