Kaynağa Gözat

Add attribute for default privacy to verify credentials (#4075)

* Add attribute for default privacy to verify credentials

* add raw_note

* source
master
Yamagishi Kazutoshi 6 yıl önce
committed by Eugen Rochko
ebeveyn
işleme
f8212da329
2 değiştirilmiş dosya ile 15 ekleme ve 2 silme
  1. +2
    -2
      app/controllers/api/v1/accounts/credentials_controller.rb
  2. +13
    -0
      app/serializers/rest/credential_account_serializer.rb

+ 2
- 2
app/controllers/api/v1/accounts/credentials_controller.rb Dosyayı Görüntüle

@@ -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


+ 13
- 0
app/serializers/rest/credential_account_serializer.rb Dosyayı Görüntüle

@@ -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

Yükleniyor…
İptal
Kaydet