Skip to content

A platform for community discussion. Free, open, simple.

DEV: Enforce learn_more_url for upcoming changes (#40150)

Martin Brennan9a86679f9c34
diff --git a/.skills/discourse-upcoming-changes/SKILL.md b/.skills/discourse-upcoming-changes/SKILL.md
index 98ff046e659..79632c8a07e 100644
--- a/.skills/discourse-upcoming-changes/SKILL.md
+++ b/.skills/discourse-upcoming-changes/SKILL.md
@@ -36,7 +36,7 @@ Note: For Status, "stable" and "permanent" are available via "Other". For Audien
**After Batch 1:** Gather any remaining information before continuing:
- If the flag name was not provided in the original message, ask for it
- If the user selected "I'll provide the path later" for Image, ask for the image path
-- Ask if they have a Learn More URL to link to (optional)
+- Ask if they have a Learn More URL to link to
### 1. Add Site Setting
@@ -52,6 +52,7 @@ enable_your_feature_name:
upcoming_change:
status: "<status from question>"
impact: "<type>,<audience>"
+ learn_more_url: "<URL from question>"
```
**Status options:** `conceptual`, `experimental`, `alpha`, `beta`, `stable`, `permanent`
@@ -61,7 +62,7 @@ enable_your_feature_name:
- Type: `feature` or `other`
- Audience: `admin`, `moderators`, `staff`, `all_members`, `developers`
-**Optional:** Add `learn_more_url: "https://..."` for documentation link.
+**Learn more URL:** Add `learn_more_url: "https://..."` for documentation link. This should generally be a Discourse Meta URL in the format https://meta.discourse.org/t/-/999999 . If the user pastes a topic URL with a slug, remove the slug and replace with a `-` as shown.
**Optional:** Add `allow_enabled_for:` to restrict which "Enabled for" dropdown options the admin can choose. Accepts any subset of `everyone`, `staff`, `specific_groups`. "No one" is always available. If `everyone` is included it must be the only value. Omit the key to allow all options (the default).
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 920a63d34a0..e5e821b34e0 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -4427,6 +4427,7 @@ experimental:
upcoming_change:
status: "stable"
impact: "feature,all_members"
+ learn_more_url: "https://meta.discourse.org/t/-/403284"
enable_new_post_reactions_menu:
default: false
client: true
@@ -4519,7 +4520,7 @@ experimental:
upcoming_change:
status: "alpha"
impact: "site_setting_default,all_members"
- learn_more_url: "http://meta.discourse.org/t/-/402843"
+ learn_more_url: "https://meta.discourse.org/t/-/402843"
allow_enabled_for:
- everyone
granular_anonymous_and_logged_in_groups_permissions:
diff --git a/plugins/discourse-ai/config/settings.yml b/plugins/discourse-ai/config/settings.yml
index 1892658c9ed..35dc8ab9a59 100644
--- a/plugins/discourse-ai/config/settings.yml
+++ b/plugins/discourse-ai/config/settings.yml
@@ -370,6 +370,7 @@ discourse_ai:
upcoming_change:
status: "alpha"
impact: "feature,all_members"
+ learn_more_url: "https://meta.discourse.org/t/-/403327"
ai_discover_enabled:
default: false
client: true
diff --git a/plugins/discourse-reactions/config/settings.yml b/plugins/discourse-reactions/config/settings.yml
index 0cc7e39d81d..95a20a530da 100644
--- a/plugins/discourse-reactions/config/settings.yml
+++ b/plugins/discourse-reactions/config/settings.yml
@@ -39,3 +39,4 @@ discourse_reactions:
upcoming_change:
status: "beta"
impact: "feature,all_members"
+ learn_more_url: "https://meta.discourse.org/t/-/403390"
diff --git a/spec/integrity/upcoming_change_metadata_spec.rb b/spec/integrity/upcoming_change_metadata_spec.rb
index 46d4388a8d3..c4b90cab6f9 100644
--- a/spec/integrity/upcoming_change_metadata_spec.rb
+++ b/spec/integrity/upcoming_change_metadata_spec.rb
@@ -53,6 +53,8 @@ RSpec.describe "upcoming change metadata integrity checks" do
status = metadata[:status].to_sym
impact = metadata[:impact]
impact_parts = impact.is_a?(String) ? impact.split(",") : []
+ learn_more_url = metadata[:learn_more_url]
+ allow_enabled_for = metadata[:allow_enabled_for]
aggregate_failures do
expect(setting[:options][:hidden]).to eq(true), "#{label} must set `hidden: true`"
@@ -79,12 +81,23 @@ RSpec.describe "upcoming change metadata integrity checks" do
"#{label} has invalid upcoming_change impact role #{impact_role.inspect}. Valid roles: #{valid_upcoming_change_impact_roles.join(", ")}"
end
- if metadata.key?(:allow_enabled_for)
- allow = metadata[:allow_enabled_for]
+ if status != :conceptual
+ aggregate_failures do
+ expect(learn_more_url).to be_present,
+ "#{label} must set `upcoming_change.learn_more_url` when status is not `conceptual`"
+
+ if learn_more_url.present?
+ expect(learn_more_url).to match(%r{\Ahttps://meta\.discourse\.org/t/-/\d+\z}),
+ "#{label} upcoming_change.learn_more_url must match https://meta.discourse.org/t/-/NNNN, do not include the topic slug"
+ end
+ end
+ end
+
+ if allow_enabled_for.present?
valid_values = %w[everyone staff specific_groups]
- allow_strings = Array(allow).map(&:to_s)
+ allow_strings = Array(allow_enabled_for).map(&:to_s)
- expect(allow).to be_an(Array),
+ expect(allow_enabled_for).to be_an(Array),
"#{label} `upcoming_change.allow_enabled_for` must be an array"
expect(allow_strings).not_to be_empty,
"#{label} `upcoming_change.allow_enabled_for` must not be empty"