A platform for community discussion. Free, open, simple.
UX: Downgrade site settings to category custom fields in solved plugin (#38402)
Martin Brennanff83da79bdb8
diff --git a/app/services/categories/types/base.rb b/app/services/categories/types/base.rbindex 2a6e3008b07..90f062d1705 100644--- a/app/services/categories/types/base.rb+++ b/app/services/categories/types/base.rb@@ -212,7 +212,7 @@ module Categoriesdef configure_custom_fields(category, guardian:, configuration_values: {})configuration_schema[:category_custom_fields]&.each do |field_name, config|value = configuration_values.fetch(field_name.to_s, config[:default])- category.custom_fields[field_name.to_s] = value+ category.custom_fields[field_name.to_s] = value.to_sendcategory.save_custom_fieldsdiff --git a/plugins/discourse-solved/app/serializers/concerns/discourse_solved/topic_answer_mixin.rb b/plugins/discourse-solved/app/serializers/concerns/discourse_solved/topic_answer_mixin.rbindex 3eb1d38bc41..f2f73c066c4 100644--- a/plugins/discourse-solved/app/serializers/concerns/discourse_solved/topic_answer_mixin.rb+++ b/plugins/discourse-solved/app/serializers/concerns/discourse_solved/topic_answer_mixin.rb@@ -21,7 +21,7 @@ module DiscourseSolvedenddef include_can_have_answer?- SiteSetting.solved_enabled && SiteSetting.empty_box_on_unsolved+ SiteSetting.solved_enabled && object.category&.empty_box_on_unsolved?endendenddiff --git a/plugins/discourse-solved/app/services/discourse_solved/accept_answer.rb b/plugins/discourse-solved/app/services/discourse_solved/accept_answer.rbindex 378a1028011..9eae1591396 100644--- a/plugins/discourse-solved/app/services/discourse_solved/accept_answer.rb+++ b/plugins/discourse-solved/app/services/discourse_solved/accept_answer.rb@@ -90,7 +90,7 @@ class DiscourseSolved::AcceptAnswerenddef should_notify_topic_owner(topic:, guardian:)- return unless SiteSetting.notify_on_staff_accept_solved+ return if !topic.category&.notify_on_staff_accept_solved?return if guardian.user.id == topic.user_id || !User.exists?(topic.user_id)screener =UserCommScreener.new(acting_user_id: guardian.user.id, target_user_ids: topic.user_id)diff --git a/plugins/discourse-solved/app/services/discourse_solved/categories/types/support.rb b/plugins/discourse-solved/app/services/discourse_solved/categories/types/support.rbindex 5a9027c9b5c..45d75ab3a32 100644--- a/plugins/discourse-solved/app/services/discourse_solved/categories/types/support.rb+++ b/plugins/discourse-solved/app/services/discourse_solved/categories/types/support.rb@@ -12,7 +12,7 @@ module DiscourseSolvedenddef category_matches?(category)- category.custom_fields[DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD] == "true"+ category.enable_accepted_answers?enddef find_matches@@ -26,6 +26,10 @@ module DiscourseSolvedenddef configure_category(category, guardian:, configuration_values: {})+ configuration_values.reverse_merge!(+ DiscourseSolved::NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD => "true",+ DiscourseSolved::EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELD => "true",+ )configuration_values.merge!(DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD => "true",)@@ -59,8 +63,6 @@ module DiscourseSolved},site_settings: {show_filter_by_solved_status: true,- notify_on_staff_accept_solved: true,- empty_box_on_unsolved: true,},category_custom_fields: {DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD => {@@ -83,6 +85,17 @@ module DiscourseSolved"discourse_solved.category_type.solved_topics_auto_close_duration.description",),},+ DiscourseSolved::NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD => {+ default: true,+ type: :bool,+ label:+ I18n.t("discourse_solved.category_type.notify_on_staff_accept_solved.label"),+ },+ DiscourseSolved::EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELD => {+ default: true,+ type: :bool,+ label: I18n.t("discourse_solved.category_type.empty_box_on_unsolved.label"),+ },},}enddiff --git a/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings-upsert.gjs b/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings-upsert.gjsindex bdc1a68d04a..8b816e20204 100644--- a/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings-upsert.gjs+++ b/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings-upsert.gjs@@ -24,11 +24,34 @@ export default class SolvedSettingsUpsert extends Component {return value?.toString() === "true";}+ get notifyOnStaffAcceptSolved() {+ const value =+ this.args.outletArgs.transientData?.custom_fields+ ?.notify_on_staff_accept_solved;+ return value?.toString() !== "false";+ }++ get emptyBoxOnUnsolved() {+ const value =+ this.args.outletArgs.transientData?.custom_fields?.empty_box_on_unsolved;+ return value?.toString() !== "false";+ }+@actionasync onToggleAcceptedAnswers(_, { set, name }) {await set(name, this.enableAcceptedAnswers ? "false" : "true");}+ @action+ async onToggleNotifyOnStaffAcceptSolved(_, { set, name }) {+ await set(name, this.notifyOnStaffAcceptSolved ? "false" : "true");+ }++ @action+ async onToggleEmptyBoxOnUnsolved(_, { set, name }) {+ await set(name, this.emptyBoxOnUnsolved ? "false" : "true");+ }+<template>{{#let @outletArgs.form as |form|}}<form.Section @title={{i18n "solved.title"}}>@@ -51,6 +74,24 @@ export default class SolvedSettingsUpsert extends Component {><field.Input @type="number" min="0" /></customFields.Field>++ <customFields.Field+ @name="notify_on_staff_accept_solved"+ @title={{i18n "solved.notify_on_staff_accept_solved"}}+ @onSet={{this.onToggleNotifyOnStaffAcceptSolved}}+ as |field|+ >+ <field.Checkbox checked={{this.notifyOnStaffAcceptSolved}} />+ </customFields.Field>++ <customFields.Field+ @name="empty_box_on_unsolved"+ @title={{i18n "solved.empty_box_on_unsolved"}}+ @onSet={{this.onToggleEmptyBoxOnUnsolved}}+ as |field|+ >+ <field.Checkbox checked={{this.emptyBoxOnUnsolved}} />+ </customFields.Field></form.Object></form.Section>{{/let}}diff --git a/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjs b/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjsindex 9196d31f985..56b1b8f4dab 100644--- a/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjs+++ b/plugins/discourse-solved/assets/javascripts/discourse/connectors/category-custom-settings/solved-settings.gjs@@ -18,6 +18,16 @@ export default class SolvedSettings extends Component {this.args.outletArgs.category.custom_fields.enable_accepted_answers ==="true";+ @tracked+ notifyOnStaffAcceptSolved =+ this.args.outletArgs.category.custom_fields+ ?.notify_on_staff_accept_solved !== "false";++ @tracked+ emptyBoxOnUnsolved =+ this.args.outletArgs.category.custom_fields?.empty_box_on_unsolved !==+ "false";+get customFields() {return this.args.outletArgs.category.custom_fields;}@@ -28,6 +38,18 @@ export default class SolvedSettings extends Component {this.customFields.enable_accepted_answers = value ? "true" : "false";}+ @action+ onChangeNotifyOnStaffAcceptSolved(value) {+ this.notifyOnStaffAcceptSolved = value;+ this.customFields.notify_on_staff_accept_solved = value ? "true" : "false";+ }++ @action+ onChangeEmptyBoxOnUnsolved(value) {+ this.emptyBoxOnUnsolved = value;+ this.customFields.empty_box_on_unsolved = value ? "true" : "false";+ }+@actiononChangeAutoCloseHours(value) {this.customFields.solved_topics_auto_close_hours = value;@@ -67,6 +89,42 @@ export default class SolvedSettings extends Component {id="auto-close-solved-topics"/></section>++ <section class="field">+ <div class="notify-on-staff-accept-solved">+ <label class="checkbox-label">+ <input+ {{on+ "change"+ (withEventValue+ this.onChangeNotifyOnStaffAcceptSolved "target.checked"+ )+ }}+ checked={{this.notifyOnStaffAcceptSolved}}+ type="checkbox"+ />+ {{i18n "solved.notify_on_staff_accept_solved"}}+ </label>+ </div>+ </section>++ <section class="field">+ <div class="empty-box-on-unsolved">+ <label class="checkbox-label">+ <input+ {{on+ "change"+ (withEventValue+ this.onChangeEmptyBoxOnUnsolved "target.checked"+ )+ }}+ checked={{this.emptyBoxOnUnsolved}}+ type="checkbox"+ />+ {{i18n "solved.empty_box_on_unsolved"}}+ </label>+ </div>+ </section></div></template>}diff --git a/plugins/discourse-solved/config/locales/client.en.yml b/plugins/discourse-solved/config/locales/client.en.ymlindex 14da644ed2d..ed0721ac513 100644--- a/plugins/discourse-solved/config/locales/client.en.yml+++ b/plugins/discourse-solved/config/locales/client.en.yml@@ -15,6 +15,8 @@ en:title: "Solved"allow_accepted_answers: "Allow topic owner and staff to mark a reply as the solution"solved_topics_auto_close_hours: "Auto close topic (n) hours after the last reply once the topic has been marked as solved."+ notify_on_staff_accept_solved: "Notify topic creator when staff marks a solution"+ empty_box_on_unsolved: "Display an empty checkbox next to unsolved topics in the topic list"accept_answer: "Select if this reply solves the problem"accepted_description: "This is the accepted solution to this topic"has_no_accepted_answer: "This topic has no solution"diff --git a/plugins/discourse-solved/config/locales/server.en.yml b/plugins/discourse-solved/config/locales/server.en.ymlindex 363f7fd97c5..9ebe0fcef2b 100644--- a/plugins/discourse-solved/config/locales/server.en.yml+++ b/plugins/discourse-solved/config/locales/server.en.yml@@ -14,6 +14,10 @@ en:solved_topics_auto_close_hours:label: "Auto close solved topics (hours)"description: "Automatically close topic after this many hours once marked as solved. Set to 0 to disable."+ notify_on_staff_accept_solved:+ label: "Notify topic creator when staff marks a solution"+ empty_box_on_unsolved:+ label: "Display an empty checkbox next to unsolved topics in the topic list"solved_topics_auto_close_duration:label: "Auto close solved topics"description: "Automatically close topic after this duration once marked as solved. Set to 0 to disable."diff --git a/plugins/discourse-solved/config/settings.yml b/plugins/discourse-solved/config/settings.ymlindex c328bdfa821..cdd44f7546d 100644--- a/plugins/discourse-solved/config/settings.yml+++ b/plugins/discourse-solved/config/settings.yml@@ -28,7 +28,7 @@ discourse_solved:validator: "AtLeastOneGroupValidator"empty_box_on_unsolved:default: false- client: true+ hidden: truesolved_quote_length:default: 300client: false@@ -41,6 +41,7 @@ discourse_solved:client: truenotify_on_staff_accept_solved:default: false+ hidden: truedisable_solved_education_message:default: falseaccept_solutions_topic_author:diff --git a/plugins/discourse-solved/db/migrate/20260310120000_populate_solved_category_custom_fields_from_site_settings.rb b/plugins/discourse-solved/db/migrate/20260310120000_populate_solved_category_custom_fields_from_site_settings.rbnew file mode 100644index 00000000000..b707d8ddf13--- /dev/null+++ b/plugins/discourse-solved/db/migrate/20260310120000_populate_solved_category_custom_fields_from_site_settings.rb@@ -0,0 +1,64 @@+# frozen_string_literal: true++class PopulateSolvedCategoryCustomFieldsFromSiteSettings < ActiveRecord::Migration[7.2]+ def up+ notify_value =+ DB.query_single(+ "SELECT value FROM site_settings WHERE name = 'notify_on_staff_accept_solved'",+ ).first++ notify_value = (notify_value == "t").to_s++ empty_box_value =+ DB.query_single("SELECT value FROM site_settings WHERE name = 'empty_box_on_unsolved'").first++ empty_box_value = (empty_box_value == "t").to_s++ allow_solved_on_all =+ DB.query_single(+ "SELECT value FROM site_settings WHERE name = 'allow_solved_on_all_topics'",+ ).first++ # When allow_solved_on_all_topics is enabled, every category can have solved topics,+ # so populate custom fields for all categories. Otherwise only populate for categories+ # that have enable_accepted_answers set.+ category_ids_sql =+ if allow_solved_on_all == "t"+ "SELECT id AS category_id FROM categories"+ else+ <<~SQL+ SELECT category_id FROM category_custom_fields+ WHERE name = 'enable_accepted_answers' AND value = 'true'+ SQL+ end++ DB.exec(<<~SQL, notify_value:)+ INSERT INTO category_custom_fields (category_id, name, value, created_at, updated_at)+ SELECT solved_cats.category_id, 'notify_on_staff_accept_solved', :notify_value, NOW(), NOW()+ FROM (#{category_ids_sql}) solved_cats+ WHERE NOT EXISTS (+ SELECT 1 FROM category_custom_fields existing+ WHERE existing.category_id = solved_cats.category_id+ AND existing.name = 'notify_on_staff_accept_solved'+ )+ SQL++ DB.exec(<<~SQL, empty_box_value:)+ INSERT INTO category_custom_fields (category_id, name, value, created_at, updated_at)+ SELECT solved_cats.category_id, 'empty_box_on_unsolved', :empty_box_value, NOW(), NOW()+ FROM (#{category_ids_sql}) solved_cats+ WHERE NOT EXISTS (+ SELECT 1 FROM category_custom_fields existing+ WHERE existing.category_id = solved_cats.category_id+ AND existing.name = 'empty_box_on_unsolved'+ )+ SQL+ end++ def down+ execute <<~SQL+ DELETE FROM category_custom_fields+ WHERE name IN ('notify_on_staff_accept_solved', 'empty_box_on_unsolved')+ SQL+ end+enddiff --git a/plugins/discourse-solved/lib/discourse_solved/category_extension.rb b/plugins/discourse-solved/lib/discourse_solved/category_extension.rbindex 1921d5196e1..f3cd07d22e8 100644--- a/plugins/discourse-solved/lib/discourse_solved/category_extension.rb+++ b/plugins/discourse-solved/lib/discourse_solved/category_extension.rb@@ -10,8 +10,41 @@ module DiscourseSolved::CategoryExtension[hours, DiscourseSolved::MAX_AUTO_CLOSE_HOURS].minend+ def enable_accepted_answers?+ custom_fields[DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD] == "true"+ end++ def enable_accepted_answers=(value)+ custom_fields[DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD] = coerce_boolean_value(+ value,+ )+ end++ def notify_on_staff_accept_solved?+ custom_fields[DiscourseSolved::NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD] == "true"+ end++ def notify_on_staff_accept_solved=(value)+ custom_fields[+ DiscourseSolved::NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD+ ] = coerce_boolean_value(value)+ end++ def empty_box_on_unsolved?+ custom_fields[DiscourseSolved::EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELD] == "true"+ end++ def empty_box_on_unsolved=(value)+ custom_fields[DiscourseSolved::EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELD] = coerce_boolean_value(value)+ end+private+ def coerce_boolean_value(value)+ return "false" if value.blank?+ %w[true false].include?(value.to_s) ? value.to_s : "false"+ end+def reset_accepted_cacheDiscourseSolved::AcceptedAnswerCache.reset_accepted_answer_cacheenddiff --git a/plugins/discourse-solved/plugin.rb b/plugins/discourse-solved/plugin.rbindex 04331def5ba..c41474a241d 100644--- a/plugins/discourse-solved/plugin.rb+++ b/plugins/discourse-solved/plugin.rb@@ -19,6 +19,8 @@ register_asset "stylesheets/mobile/solutions.scss", :mobilemodule ::DiscourseSolvedPLUGIN_NAME = "discourse-solved"ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD = "enable_accepted_answers"+ NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD = "notify_on_staff_accept_solved"+ EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELD = "empty_box_on_unsolved"MAX_AUTO_CLOSE_HOURS = 20.years.to_i / 1.hour.to_idef self.accept_answer!(post, acting_user, topic: nil)@@ -66,6 +68,8 @@ after_initialize doregister_topic_preloader_associations(:solved) if SiteSetting.solved_enabledSearch.custom_topic_eager_load { [:solved] } if SiteSetting.solved_enabledSite.preloaded_category_custom_fields << DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD+ Site.preloaded_category_custom_fields << DiscourseSolved::NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD+ Site.preloaded_category_custom_fields << DiscourseSolved::EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELDadd_api_key_scope(:solved,diff --git a/plugins/discourse-solved/spec/integration/solved_spec.rb b/plugins/discourse-solved/spec/integration/solved_spec.rbindex 0d208ce172b..a807742b0b9 100644--- a/plugins/discourse-solved/spec/integration/solved_spec.rb+++ b/plugins/discourse-solved/spec/integration/solved_spec.rb@@ -300,9 +300,10 @@ RSpec.describe "Managing Posts solved status" doendit "sends notifications to correct users" do- SiteSetting.notify_on_staff_accept_solved = trueuser = Fabricate(:user)topic = Fabricate(:topic, user: user)+ topic.category.notify_on_staff_accept_solved = true+ topic.category.save_custom_fieldspost = Fabricate(:post, post_number: 2, topic: topic)op = topic.user@@ -332,13 +333,12 @@ RSpec.describe "Managing Posts solved status" dofab!(:solution_accepter) { Fabricate(:user, trust_level: 4) }fab!(:author, :user)- before do- SiteSetting.notify_on_staff_accept_solved = true- MutedUser.create!(user_id: author.id, muted_user_id: solution_accepter.id)- end+ before { MutedUser.create!(user_id: author.id, muted_user_id: solution_accepter.id) }it "does not send notification to post author" dotopic = Fabricate(:topic, user: Fabricate(:user))+ topic.category.notify_on_staff_accept_solved = true+ topic.category.save_custom_fieldspost = Fabricate(:post, post_number: 2, topic: topic, user: author)expect {@@ -353,6 +353,8 @@ RSpec.describe "Managing Posts solved status" doit "does not send notification to topic author" dotopic = Fabricate(:topic, user: author)+ topic.category.notify_on_staff_accept_solved = true+ topic.category.save_custom_fieldspost = Fabricate(:post, post_number: 2, topic: topic, user: Fabricate(:user))expect {@@ -378,7 +380,8 @@ RSpec.describe "Managing Posts solved status" doendit "works when the topic author has been deleted" do- SiteSetting.notify_on_staff_accept_solved = true+ topic.category.notify_on_staff_accept_solved = true+ topic.category.save_custom_fieldsSiteSetting.solved_topics_auto_close_hours = 0topic.user.destroy!topic.reloaddiff --git a/plugins/discourse-solved/spec/models/discourse_solved/categories_types_support_spec.rb b/plugins/discourse-solved/spec/models/discourse_solved/categories_types_support_spec.rbindex 2fd1a4c1b42..83ac32f5116 100644--- a/plugins/discourse-solved/spec/models/discourse_solved/categories_types_support_spec.rb+++ b/plugins/discourse-solved/spec/models/discourse_solved/categories_types_support_spec.rb@@ -26,8 +26,6 @@ RSpec.describe DiscourseSolved::Categories::Types::Support dodescribed_class.configure_site_settings(category, guardian: admin.guardian)expect(SiteSetting.show_filter_by_solved_status).to eq(true)- expect(SiteSetting.notify_on_staff_accept_solved).to eq(true)- expect(SiteSetting.empty_box_on_unsolved).to eq(true)endit "uses provided configuration_values over defaults" do@@ -36,13 +34,10 @@ RSpec.describe DiscourseSolved::Categories::Types::Support doguardian: admin.guardian,configuration_values: {"show_filter_by_solved_status" => false,- "empty_box_on_unsolved" => false,},)expect(SiteSetting.show_filter_by_solved_status).to eq(false)- expect(SiteSetting.notify_on_staff_accept_solved).to eq(true)- expect(SiteSetting.empty_box_on_unsolved).to eq(false)endend@@ -87,6 +82,22 @@ RSpec.describe DiscourseSolved::Categories::Types::Support doexpect(category.custom_fields["solved_topics_auto_close_hours"]).to eq("72")end++ it "sets notify_on_staff_accept_solved custom field" do+ described_class.configure_category(category, guardian: admin.guardian)++ expect(+ category.custom_fields[DiscourseSolved::NOTIFY_ON_STAFF_ACCEPT_SOLVED_CUSTOM_FIELD],+ ).to eq("true")+ end++ it "sets empty_box_on_unsolved custom field" do+ described_class.configure_category(category, guardian: admin.guardian)++ expect(category.custom_fields[DiscourseSolved::EMPTY_BOX_ON_UNSOLVED_CUSTOM_FIELD]).to eq(+ "true",+ )+ endenddescribe ".find_matches" dodiff --git a/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rb b/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rbindex eb0be5789c8..0756e26d8a5 100644--- a/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rb+++ b/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe DiscourseSolved::AcceptAnswer do- describe described_class::Contract, type: :model do+ describe ::DiscourseSolved::AcceptAnswer::Contract, type: :model doit { is_expected.to validate_presence_of(:post_id) }end@@ -135,7 +135,10 @@ RSpec.describe DiscourseSolved::AcceptAnswer doendcontext "when notify_on_staff_accept_solved is enabled" do- before { SiteSetting.notify_on_staff_accept_solved = true }+ before do+ category.notify_on_staff_accept_solved = true+ category.save_custom_fields+ endcontext "when a staff member accepts on behalf of the topic owner" dofab!(:acting_user, :admin)@@ -163,7 +166,10 @@ RSpec.describe DiscourseSolved::AcceptAnswer doendcontext "when notify_on_staff_accept_solved is disabled" do- before { SiteSetting.notify_on_staff_accept_solved = false }+ before do+ category.notify_on_staff_accept_solved = false+ category.save_custom_fields+ endit "does not notify the topic owner" doexpect { result }.not_to change {diff --git a/plugins/discourse-solved/spec/services/discourse_solved/unaccept_answer_spec.rb b/plugins/discourse-solved/spec/services/discourse_solved/unaccept_answer_spec.rbindex 91c8a91e098..17418635048 100644--- a/plugins/discourse-solved/spec/services/discourse_solved/unaccept_answer_spec.rb+++ b/plugins/discourse-solved/spec/services/discourse_solved/unaccept_answer_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe DiscourseSolved::UnacceptAnswer do- describe described_class::Contract, type: :model do+ describe ::DiscourseSolved::UnacceptAnswer::Contract, type: :model doit { is_expected.to validate_presence_of(:post_id) }enddiff --git a/plugins/discourse-solved/spec/system/support_category_type_setup_spec.rb b/plugins/discourse-solved/spec/system/support_category_type_setup_spec.rbindex 4b8a4d0197f..a08c9d6ce17 100644--- a/plugins/discourse-solved/spec/system/support_category_type_setup_spec.rb+++ b/plugins/discourse-solved/spec/system/support_category_type_setup_spec.rb@@ -35,11 +35,11 @@ RSpec.describe "Support Category Type Setup", type: :system doexpect(page).to have_content(I18n.t("js.category.edit_dialog_title", categoryName: "Support"))expect(SiteSetting.solved_enabled).to eq(true)expect(SiteSetting.show_filter_by_solved_status).to eq(true)- expect(SiteSetting.notify_on_staff_accept_solved).to eq(true)- expect(SiteSetting.empty_box_on_unsolved).to eq(true)category = Category.find_by(name: "Support")expect(category.custom_fields["enable_accepted_answers"]).to eq("true")expect(category.custom_fields["solved_topics_auto_close_hours"]).to eq("48")+ expect(category.custom_fields["notify_on_staff_accept_solved"]).to eq("true")+ expect(category.custom_fields["empty_box_on_unsolved"]).to eq("true")endcontext "when there is a support category already configured" do