Fix bug
This commit is contained in:
parent
bc83963ac7
commit
f74bc309b1
1 changed files with 5 additions and 2 deletions
|
@ -2,6 +2,7 @@ import $ from 'cafy';
|
||||||
import { publishMainStream } from '../../../../services/stream';
|
import { publishMainStream } from '../../../../services/stream';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
import { UserProfiles } from '../../../../models';
|
import { UserProfiles } from '../../../../models';
|
||||||
|
import { ensure } from '../../../../prelude/ensure';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
@ -20,11 +21,13 @@ export const meta = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, async (ps, user) => {
|
export default define(meta, async (ps, user) => {
|
||||||
|
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||||
|
|
||||||
await UserProfiles.createQueryBuilder().update()
|
await UserProfiles.createQueryBuilder().update()
|
||||||
.set({
|
.set({
|
||||||
clientData: {
|
clientData: Object.assign(profile.clientData, {
|
||||||
[ps.name]: ps.value
|
[ps.name]: ps.value
|
||||||
},
|
}),
|
||||||
})
|
})
|
||||||
.where('userId = :id', { id: user.id })
|
.where('userId = :id', { id: user.id })
|
||||||
.execute();
|
.execute();
|
||||||
|
|
Loading…
Reference in a new issue