Skip to content

A platform for community discussion. Free, open, simple.

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

Blake Erickson704a792f1897
diff --git a/app/models/api_key_scope.rb b/app/models/api_key_scope.rb
index b272efd4092..f6662815b7e 100644
--- a/app/models/api_key_scope.rb
+++ b/app/models/api_key_scope.rb
@@ -61,6 +61,9 @@ class ApiKeyScope < ActiveRecord::Base
delete: {
actions: %w[posts#destroy],
},
+ list: {
+ actions: %w[posts#latest],
+ },
},
tags: {
list: {
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 2fdcfa4cdc5..55b4689250f 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -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:
diff --git a/spec/requests/admin/api_controller_spec.rb b/spec/requests/admin/api_controller_spec.rb
index 9f1d94c32a9..3d6bae83881 100644
--- a/spec/requests/admin/api_controller_spec.rb
+++ b/spec/requests/admin/api_controller_spec.rb
@@ -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