aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/me.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users/me.ts')
-rw-r--r--server/controllers/api/users/me.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index ce9e78463..ddb239e7b 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -129,7 +129,7 @@ async function getUserInformation (req: express.Request, res: express.Response)
129 // We did not load channels in res.locals.user 129 // We did not load channels in res.locals.user
130 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username) 130 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
131 131
132 return res.json(user.toFormattedJSON()) 132 return res.json(user.toFormattedJSON({}))
133} 133}
134 134
135async function getUserVideoQuotaUsed (req: express.Request, res: express.Response) { 135async function getUserVideoQuotaUsed (req: express.Request, res: express.Response) {
@@ -164,7 +164,7 @@ async function deleteMe (req: express.Request, res: express.Response) {
164 164
165 await user.destroy() 165 await user.destroy()
166 166
167 auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) 167 auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON({})))
168 168
169 return res.sendStatus(204) 169 return res.sendStatus(204)
170} 170}
@@ -173,7 +173,7 @@ async function updateMe (req: express.Request, res: express.Response) {
173 const body: UserUpdateMe = req.body 173 const body: UserUpdateMe = req.body
174 174
175 const user = res.locals.oauth.token.user 175 const user = res.locals.oauth.token.user
176 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 176 const oldUserAuditView = new UserAuditView(user.toFormattedJSON({}))
177 177
178 if (body.password !== undefined) user.password = body.password 178 if (body.password !== undefined) user.password = body.password
179 if (body.email !== undefined) user.email = body.email 179 if (body.email !== undefined) user.email = body.email
@@ -193,7 +193,7 @@ async function updateMe (req: express.Request, res: express.Response) {
193 193
194 await sendUpdateActor(userAccount, t) 194 await sendUpdateActor(userAccount, t)
195 195
196 auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()), oldUserAuditView) 196 auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON({})), oldUserAuditView)
197 }) 197 })
198 198
199 return res.sendStatus(204) 199 return res.sendStatus(204)
@@ -202,13 +202,13 @@ async function updateMe (req: express.Request, res: express.Response) {
202async function updateMyAvatar (req: express.Request, res: express.Response) { 202async function updateMyAvatar (req: express.Request, res: express.Response) {
203 const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ] 203 const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]
204 const user = res.locals.oauth.token.user 204 const user = res.locals.oauth.token.user
205 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 205 const oldUserAuditView = new UserAuditView(user.toFormattedJSON({}))
206 206
207 const userAccount = await AccountModel.load(user.Account.id) 207 const userAccount = await AccountModel.load(user.Account.id)
208 208
209 const avatar = await updateActorAvatarFile(avatarPhysicalFile, userAccount) 209 const avatar = await updateActorAvatarFile(avatarPhysicalFile, userAccount)
210 210
211 auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()), oldUserAuditView) 211 auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON({})), oldUserAuditView)
212 212
213 return res.json({ avatar: avatar.toFormattedJSON() }) 213 return res.json({ avatar: avatar.toFormattedJSON() })
214} 214}