mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Add attribute for default privacy to verify credentials (#4075)
* Add attribute for default privacy to verify credentials * add raw_note * source
This commit is contained in:
parent
4122a837fa
commit
f8212da329
@ -6,13 +6,13 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@account = current_account
|
@account = current_account
|
||||||
render json: @account, serializer: REST::AccountSerializer
|
render json: @account, serializer: REST::CredentialAccountSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
current_account.update!(account_params)
|
current_account.update!(account_params)
|
||||||
@account = current_account
|
@account = current_account
|
||||||
render json: @account, serializer: REST::AccountSerializer
|
render json: @account, serializer: REST::CredentialAccountSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
13
app/serializers/rest/credential_account_serializer.rb
Normal file
13
app/serializers/rest/credential_account_serializer.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class REST::CredentialAccountSerializer < REST::AccountSerializer
|
||||||
|
attributes :source
|
||||||
|
|
||||||
|
def source
|
||||||
|
user = object.user
|
||||||
|
{
|
||||||
|
privacy: user.setting_default_privacy,
|
||||||
|
note: object.note,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user