aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-20 17:44:09 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-20 17:44:09 +0200
commitf09ebd80b32ee1beac2bfc1de358de14f947bdbc (patch)
tree4c953014d54bcc896a191a877dd4512f8cec9bf2 /app
parentAdd page to transfer user accounts (diff)
downloadferdium-server-f09ebd80b32ee1beac2bfc1de358de14f947bdbc.tar.gz
ferdium-server-f09ebd80b32ee1beac2bfc1de358de14f947bdbc.tar.zst
ferdium-server-f09ebd80b32ee1beac2bfc1de358de14f947bdbc.zip
Implement user settings
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/Http/UserController.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js
index 1e67092..3f6103a 100644
--- a/app/Controllers/Http/UserController.js
+++ b/app/Controllers/Http/UserController.js
@@ -146,6 +146,30 @@ class UserController {
146 isSubscriptionOwner: true, 146 isSubscriptionOwner: true,
147 lastname: 'Franz', 147 lastname: 'Franz',
148 locale: 'en-US', 148 locale: 'en-US',
149 ...auth.user.settings || {},
150 });
151 }
152
153 async updateMe({
154 request,
155 response,
156 auth
157 }) {
158 let settings = auth.user.settings || {};
159 if (typeof settings === 'string') {
160 settings = JSON.parse(settings);
161 }
162
163 let newSettings = {
164 ...settings,
165 ...request.all(),
166 }
167
168 auth.user.settings = JSON.stringify(newSettings);
169 await auth.user.save();
170
171 return response.send({
172 status: 'success'
149 }); 173 });
150 } 174 }
151 175