commit: f8212da329cf857478746c23314e5c662cd490e3
parent: 4122a837fadf8cf59712b5c1790ac0af96bcbc84
Author: Yamagishi Kazutoshi <ykzts@desire.sh>
Date: Mon, 10 Jul 2017 10:29:34 +0900
Add attribute for default privacy to verify credentials (#4075)
* Add attribute for default privacy to verify credentials
* add raw_note
* source
Diffstat:
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb
@@ -6,13 +6,13 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
def show
@account = current_account
- render json: @account, serializer: REST::AccountSerializer
+ render json: @account, serializer: REST::CredentialAccountSerializer
end
def update
current_account.update!(account_params)
@account = current_account
- render json: @account, serializer: REST::AccountSerializer
+ render json: @account, serializer: REST::CredentialAccountSerializer
end
private
diff --git a/app/serializers/rest/credential_account_serializer.rb b/app/serializers/rest/credential_account_serializer.rb
@@ -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