Add documentation for Profiles::Update (#13723)

This commit is contained in:
Michael Kohl 2021-05-12 09:59:39 +07:00 committed by GitHub
parent 11bab732c0
commit fa2ff578ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
module Profiles
# Deals with updates that affect fields on +Profile+ and/or +User+ in a transparent way.
class Update
using HashAnyKey
include ImageUploads
@ -6,6 +7,16 @@ module Profiles
CORE_PROFILE_FIELDS = %i[summary brand_color1 brand_color2].freeze
CORE_USER_FIELDS = %i[name username profile_image].freeze
# @param user [User] the user whose profile we are updating
# @param updated_attributes [Hash<Symbol, Hash<Symbol, Object>>] the profile
# and/or user attributes to update. The corresponding has keys are +:user+ and
# +:profile+ respectively.
# @example
# Profiles::Update.call(
# current_user,
# profile: { website_url: "https://example.com" },
# )
# @return [Profiles::Update] a class instance that can be used for success checks
def self.call(user, updated_attributes = {})
new(user, updated_attributes).call
end