FEATURE: Add API Scopes (#228)

Adds a single API scope for accepting or unaccepting a solution.
This commit is contained in:
Blake Erickson 2023-02-23 15:00:14 -07:00 committed by GitHub
parent 8a4daddb8e
commit 65a9ccf876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,11 @@ en:
solved_event:
name: "Solved Event"
details: "When a user marks a post as the accepted or unaccepted answer."
api:
scopes:
descriptions:
solved:
answer: Accept/Unaccept a solution.
discourse_automation:
triggerables:

View File

@ -249,6 +249,11 @@ SQL
Discourse::Application.routes.append { mount ::DiscourseSolved::Engine, at: "solution" }
add_api_key_scope(
:solved,
{ answer: { actions: %w[discourse_solved/answer#accept discourse_solved/answer#unaccept] } },
)
topic_view_post_custom_fields_allowlister { ["is_accepted_answer"] }
def get_schema_text(post)