diff --git a/db/migrate/20230103004613_make_experimental_hashtag_feature_default_for_new_sites.rb b/db/migrate/20230103004613_make_experimental_hashtag_feature_default_for_new_sites.rb index e0047fdb3c4..55f6d340367 100644 --- a/db/migrate/20230103004613_make_experimental_hashtag_feature_default_for_new_sites.rb +++ b/db/migrate/20230103004613_make_experimental_hashtag_feature_default_for_new_sites.rb @@ -2,11 +2,21 @@ class MakeExperimentalHashtagFeatureDefaultForNewSites < ActiveRecord::Migration[7.0] def up - execute(<<~SQL) + result = execute <<~SQL + SELECT created_at + FROM schema_migration_details + ORDER BY created_at + LIMIT 1 + SQL + + settings_insert_query = <<~SQL INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('enable_experimental_hashtag_autocomplete', 5, 'f', now(), now()) ON CONFLICT DO NOTHING SQL + + # keep enable_experimental_hashtag_autocomplete disabled for for existing sites + execute settings_insert_query if result.first["created_at"].to_datetime < 1.hour.ago end def down diff --git a/plugins/chat/spec/models/chat_message_spec.rb b/plugins/chat/spec/models/chat_message_spec.rb index 1ce6a39ed36..9e305f98f25 100644 --- a/plugins/chat/spec/models/chat_message_spec.rb +++ b/plugins/chat/spec/models/chat_message_spec.rb @@ -234,8 +234,10 @@ describe ChatMessage do expect(cooked).to eq("
@mention
") end - # TODO (martin) Remove this when enable_experimental_hashtag_autocomplete is default it "supports category-hashtag plugin" do + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + category = Fabricate(:category) cooked = ChatMessage.cook("##{category.slug}") diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb index 82e5024e99e..14561dceed8 100644 --- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb +++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb @@ -494,6 +494,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do end it "should create the right reply" do + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + category = Fabricate(:category) post.update!(raw: "Check out this ##{category.slug}") diff --git a/spec/integrity/common_mark_spec.rb b/spec/integrity/common_mark_spec.rb index c89f9ff0e81..85c8c821227 100644 --- a/spec/integrity/common_mark_spec.rb +++ b/spec/integrity/common_mark_spec.rb @@ -5,6 +5,9 @@ RSpec.describe "CommonMark" do SiteSetting.enable_markdown_typographer = false SiteSetting.highlighted_languages = "ruby|aa" + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + html, state, md = nil failed = 0 diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rb index 25a8d80749b..7b3ef983203 100644 --- a/spec/lib/pretty_text_spec.rb +++ b/spec/lib/pretty_text_spec.rb @@ -1619,6 +1619,9 @@ RSpec.describe PrettyText do end it "produces hashtag links" do + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + category = Fabricate(:category, name: "testing") category2 = Fabricate(:category, name: "known") Fabricate(:topic, tags: [Fabricate(:tag, name: "known")]) @@ -1908,6 +1911,9 @@ HTML end it "does not replace hashtags and mentions" do + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + Fabricate(:user, username: "test") category = Fabricate(:category, slug: "test") Fabricate( @@ -1927,6 +1933,9 @@ HTML end it "does not replace hashtags and mentions when watched words are regular expressions" do + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + SiteSetting.watched_words_regular_expressions = true Fabricate(:user, username: "test") diff --git a/spec/requests/hashtags_controller_spec.rb b/spec/requests/hashtags_controller_spec.rb index 9cffbf5b96f..2d2b0f3ca67 100644 --- a/spec/requests/hashtags_controller_spec.rb +++ b/spec/requests/hashtags_controller_spec.rb @@ -14,6 +14,10 @@ RSpec.describe HashtagsController do before do SiteSetting.tagging_enabled = true + + # TODO (martin) Remove when enable_experimental_hashtag_autocomplete is default for all sites + SiteSetting.enable_experimental_hashtag_autocomplete = false + tag_group end