diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index cdf3b79..697ee04 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -9,6 +9,8 @@ en: show_filter_by_solved_status: "Show a dropdown to filter a topic list by solved status." notify_on_staff_accept_solved: "Send notification to the topic creator when a post is marked as solution by a staff." disable_solved_education_message: "Disable education message for solved topics." + accept_solutions_topic_author: "Allow the topic author to accept a solution." + solved_add_schema_markup: "Add QAPage schema markup to HTML." reports: accepted_solutions: title: "Accepted solutions" diff --git a/config/settings.yml b/config/settings.yml index 4b73877..335cdf5 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -25,3 +25,13 @@ plugins: default: false disable_solved_education_message: default: false + accept_solutions_topic_author: + default: true + solved_add_schema_markup: + type: enum + default: "always" + choices: + - "never" + - "always" + - "answered only" + diff --git a/plugin.rb b/plugin.rb index 01f5e14..78e4405 100644 --- a/plugin.rb +++ b/plugin.rb @@ -282,6 +282,7 @@ SQL # it can get confusing to have this on every page and it should make page 1 # a bit more prominent + cut down on pointless work + return "" if SiteSetting.solved_add_schema_markup == "never" return "" if !controller.guardian.allow_accepted_answers_on_category?(topic.category_id) first_post = topic_view.posts&.first @@ -313,6 +314,8 @@ SQL 'name' => accepted_answer.user&.username } } + else + return "" if SiteSetting.solved_add_schema_markup == "answered only" end ['