Two extra options (#138)

* Make it possible to disallow topic starters to accept a solution

* Make adding QAPage schema markup optional

* Address @eviltrout's comments

Co-authored-by: Richard <[email protected]>
This commit is contained in:
communiteq
2021-06-17 16:12:33 -04:00
committed by GitHub
co-authored by Richard
parent 7351882171
commit ca0dbd6d4c
3 changed files with 16 additions and 1 deletions
+2
View File
@@ -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"
+10
View File
@@ -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"
+4 -1
View File
@@ -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
['<script type="application/ld+json">', MultiJson.dump(
@@ -483,7 +486,7 @@ SQL
return true if can_perform_action_available_to_group_moderators?(topic)
end
topic.user_id == current_user.id && !topic.closed
topic.user_id == current_user.id && !topic.closed && SiteSetting.accept_solutions_topic_author
end
end