Allow updating bio fields via PUT /api/v1/accounts/update_credentials (#7288)
Add raw bio fields to the source attribute on GET /api/v1/accounts/verify_credentials
This commit is contained in:
parent
f62539ce5c
commit
cae933510c
3 changed files with 7 additions and 1 deletions
|
@ -21,7 +21,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
|
||||||
private
|
private
|
||||||
|
|
||||||
def account_params
|
def account_params
|
||||||
params.permit(:display_name, :note, :avatar, :header, :locked)
|
params.permit(:display_name, :note, :avatar, :header, :locked, fields_attributes: [:name, :value])
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_settings_params
|
def user_settings_params
|
||||||
|
|
|
@ -273,6 +273,10 @@ class Account < ApplicationRecord
|
||||||
@value = attr['value']
|
@value = attr['value']
|
||||||
@errors = {}
|
@errors = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_h
|
||||||
|
{ name: @name, value: @value }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
|
@ -5,10 +5,12 @@ class REST::CredentialAccountSerializer < REST::AccountSerializer
|
||||||
|
|
||||||
def source
|
def source
|
||||||
user = object.user
|
user = object.user
|
||||||
|
|
||||||
{
|
{
|
||||||
privacy: user.setting_default_privacy,
|
privacy: user.setting_default_privacy,
|
||||||
sensitive: user.setting_default_sensitive,
|
sensitive: user.setting_default_sensitive,
|
||||||
note: object.note,
|
note: object.note,
|
||||||
|
fields: object.fields.map(&:to_h),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue