From 58501a26821160c3258c1ad3501f4c1d8db0a597 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 23 Jun 2021 21:58:44 +0200 Subject: [API] GET / SET User Settings (#16169) * API: GET/SET User Settings * linter * Apply suggestions from code review * Update modules/structs/user.go * lint * fix swagger * move User2UserSettings to convert * as per @zeripath "preferences" -> "settings" Co-authored-by: techknowlogick Co-authored-by: techknowlogick --- modules/convert/user.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules/convert') diff --git a/modules/convert/user.go b/modules/convert/user.go index 07a4efd41a..894be3bd44 100644 --- a/modules/convert/user.go +++ b/modules/convert/user.go @@ -76,3 +76,18 @@ func toUser(user *models.User, signed, authed bool) *api.User { } return result } + +// User2UserSettings return UserSettings based on a user +func User2UserSettings(user *models.User) api.UserSettings { + return api.UserSettings{ + FullName: user.FullName, + Website: user.Website, + Location: user.Location, + Language: user.Language, + Description: user.Description, + Theme: user.Theme, + HideEmail: user.KeepEmailPrivate, + HideActivity: user.KeepActivityPrivate, + DiffViewStyle: user.DiffViewStyle, + } +} -- cgit v1.2.3