mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
move website from User to UserProfile
This commit is contained in:
@@ -770,7 +770,6 @@ end
|
||||
# username_lower :string(60) not null
|
||||
# auth_token :string(32)
|
||||
# last_seen_at :datetime
|
||||
# website :string(255)
|
||||
# admin :boolean default(FALSE), not null
|
||||
# last_emailed_at :datetime
|
||||
# email_digests :boolean not null
|
||||
|
||||
@@ -7,4 +7,5 @@ end
|
||||
#
|
||||
# user_id :integer not null, primary key
|
||||
# location :string(255)
|
||||
# website :string(255)
|
||||
#
|
||||
|
||||
@@ -116,6 +116,13 @@ class UserSerializer < BasicUserSerializer
|
||||
location.present?
|
||||
end
|
||||
|
||||
def website
|
||||
object.user_profile.try(:website)
|
||||
end
|
||||
def include_website?
|
||||
website.present?
|
||||
end
|
||||
|
||||
def stats
|
||||
UserAction.stats(object.id, scope)
|
||||
end
|
||||
|
||||
@@ -28,7 +28,8 @@ class UserUpdater
|
||||
end
|
||||
|
||||
def update(attributes = {})
|
||||
user.website = format_url(attributes.fetch(:website) { user.website })
|
||||
user_profile = user.user_profile
|
||||
user_profile.website = format_url(attributes.fetch(:website) { user_profile.website })
|
||||
|
||||
user.bio_raw = attributes.fetch(:bio_raw) { user.bio_raw }
|
||||
user.name = attributes.fetch(:name) { user.name }
|
||||
@@ -59,7 +60,6 @@ class UserUpdater
|
||||
end
|
||||
end
|
||||
|
||||
user_profile = user.user_profile
|
||||
PROFILE_ATTR.each do |attribute|
|
||||
user_profile.send("#{attribute.to_s}=", attributes[attribute])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user