A platform for community discussion. Free, open, simple.
DEV: Expose `avatarTemplate` on JSON:API users (#44917)
Jarek Radoszabee4cb4763f
diff --git a/app/resources/user_resource.rb b/app/resources/user_resource.rbindex 958f62685ef..52a4fc1a8d2 100644--- a/app/resources/user_resource.rb+++ b/app/resources/user_resource.rb@@ -2,4 +2,5 @@class UserResource < JsonApiKit::Resourceattribute :username+ attribute :avatar_templateenddiff --git a/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rb b/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rbindex 36190c93c69..a65b4753afe 100644--- a/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rb+++ b/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rb@@ -164,6 +164,7 @@ RSpec.describe "JSON:API queries", type: :request do"id" => author.id.to_s,"attributes" => {"username" => "query_author",+ "avatarTemplate" => author.avatar_template,},"links" => {"self" => "#{root}/users/#{author.id}",diff --git a/spec/resources/user_resource_spec.rb b/spec/resources/user_resource_spec.rbindex e27d95f4e3b..94ea1590b88 100644--- a/spec/resources/user_resource_spec.rb+++ b/spec/resources/user_resource_spec.rb@@ -12,12 +12,13 @@ RSpec.describe UserResource doJsonApiKit::Document::Individual.for(user.id, {}, resource: described_class, client:)end- it "shows the username and nothing else" do+ it "shows the username and the avatar template" doexpect(document.to_h[:data]).to eq(type: "users",id: user.id.to_s,attributes: {"username" => "someone",+ "avatarTemplate" => user.avatar_template,},links: {self: "https://example.com/api/users/#{user.id}",