FEATURE: Add API Scope for latest posts (#21913)

Adds api scopes for

- `/posts.json`
- `/posts.rss`
- `/private-posts.json`
- `/private-posts.rss`
This commit is contained in:
Blake Erickson 2023-06-05 09:04:34 -06:00 committed by GitHub
parent 2032d3c2fb
commit 704a792f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -61,6 +61,9 @@ class ApiKeyScope < ActiveRecord::Base
delete: {
actions: %w[posts#destroy],
},
list: {
actions: %w[posts#latest],
},
},
tags: {
list: {

View File

@ -4778,6 +4778,7 @@ en:
posts:
edit: Edit any post or a specific one.
delete: Delete a post.
list: List latest posts and private posts. RSS is also supported.
tags:
list: List tags.
categories:

View File

@ -436,6 +436,8 @@ RSpec.describe Admin::ApiController do
)
expect(scopes["topics"].any? { |h| h["urls"].include?("/latest.rss (GET)") }).to be_truthy
expect(scopes["posts"].any? { |h| h["urls"].include?("/posts (GET)") }).to be_truthy
expect(scopes["posts"].any? { |h| h["urls"].include?("/private-posts (GET)") }).to be_truthy
end
end