summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-06-25 01:24:01 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-06-25 01:24:01 +0900
commitf74bc309b189d0b716ed0f8f0f7891aea53079fe (patch)
tree51fce36e36577cbe504136f29e2aefbb513de6ff /src/server
parentEnglish nyaize (diff)
downloadsharkey-f74bc309b189d0b716ed0f8f0f7891aea53079fe.tar.gz
sharkey-f74bc309b189d0b716ed0f8f0f7891aea53079fe.tar.bz2
sharkey-f74bc309b189d0b716ed0f8f0f7891aea53079fe.zip
Fix bug
Diffstat (limited to 'src/server')
-rw-r--r--src/server/api/endpoints/i/update-client-setting.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/server/api/endpoints/i/update-client-setting.ts b/src/server/api/endpoints/i/update-client-setting.ts
index 36de183379..f79961a4f9 100644
--- a/src/server/api/endpoints/i/update-client-setting.ts
+++ b/src/server/api/endpoints/i/update-client-setting.ts
@@ -2,6 +2,7 @@ import $ from 'cafy';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
import { UserProfiles } from '../../../../models';
+import { ensure } from '../../../../prelude/ensure';
export const meta = {
requireCredential: true,
@@ -20,11 +21,13 @@ export const meta = {
};
export default define(meta, async (ps, user) => {
+ const profile = await UserProfiles.findOne(user.id).then(ensure);
+
await UserProfiles.createQueryBuilder().update()
.set({
- clientData: {
+ clientData: Object.assign(profile.clientData, {
[ps.name]: ps.value
- },
+ }),
})
.where('userId = :id', { id: user.id })
.execute();