summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/i/update.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-10 15:04:27 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-10 15:04:27 +0900
commit626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c (patch)
tree23b89c000b1b169c36cffc7a345a2fc1ebe33347 /src/server/api/endpoints/i/update.ts
parentDelete get-user-summary.ts (diff)
downloadmisskey-626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c.tar.gz
misskey-626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c.tar.bz2
misskey-626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c.zip
テーブル分割
Diffstat (limited to 'src/server/api/endpoints/i/update.ts')
-rw-r--r--src/server/api/endpoints/i/update.ts28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts
index 54e7f33bdb..ffc90b2f51 100644
--- a/src/server/api/endpoints/i/update.ts
+++ b/src/server/api/endpoints/i/update.ts
@@ -10,7 +10,9 @@ import extractHashtags from '../../../../misc/extract-hashtags';
import * as langmap from 'langmap';
import { updateHashtag } from '../../../../services/update-hashtag';
import { ApiError } from '../../error';
-import { Users, DriveFiles } from '../../../../models';
+import { Users, DriveFiles, UserProfiles } from '../../../../models';
+import { User } from '../../../../models/entities/user';
+import { UserProfile } from '../../../../models/entities/user-profile';
export const meta = {
desc: {
@@ -154,22 +156,23 @@ export const meta = {
export default define(meta, async (ps, user, app) => {
const isSecure = user != null && app == null;
- const updates = {} as any;
+ const updates = {} as Partial<User>;
+ const profile = {} as Partial<UserProfile>;
if (ps.name !== undefined) updates.name = ps.name;
- if (ps.description !== undefined) updates.description = ps.description;
- if (ps.lang !== undefined) updates.lang = ps.lang;
- if (ps.location !== undefined) updates.location = ps.location;
- if (ps.birthday !== undefined) updates.birthday = ps.birthday;
+ if (ps.description !== undefined) profile.description = ps.description;
+ //if (ps.lang !== undefined) updates.lang = ps.lang;
+ if (ps.location !== undefined) profile.location = ps.location;
+ if (ps.birthday !== undefined) profile.birthday = ps.birthday;
if (ps.avatarId !== undefined) updates.avatarId = ps.avatarId;
if (ps.bannerId !== undefined) updates.bannerId = ps.bannerId;
if (typeof ps.isLocked == 'boolean') updates.isLocked = ps.isLocked;
if (typeof ps.isBot == 'boolean') updates.isBot = ps.isBot;
- if (typeof ps.carefulBot == 'boolean') updates.carefulBot = ps.carefulBot;
- if (typeof ps.autoAcceptFollowed == 'boolean') updates.autoAcceptFollowed = ps.autoAcceptFollowed;
+ if (typeof ps.carefulBot == 'boolean') profile.carefulBot = ps.carefulBot;
+ if (typeof ps.autoAcceptFollowed == 'boolean') profile.autoAcceptFollowed = ps.autoAcceptFollowed;
if (typeof ps.isCat == 'boolean') updates.isCat = ps.isCat;
- if (typeof ps.autoWatch == 'boolean') updates.autoWatch = ps.autoWatch;
- if (typeof ps.alwaysMarkNsfw == 'boolean') updates.alwaysMarkNsfw = ps.alwaysMarkNsfw;
+ if (typeof ps.autoWatch == 'boolean') profile.autoWatch = ps.autoWatch;
+ if (typeof ps.alwaysMarkNsfw == 'boolean') profile.alwaysMarkNsfw = ps.alwaysMarkNsfw;
if (ps.avatarId) {
const avatar = await DriveFiles.findOne(ps.avatarId);
@@ -206,8 +209,8 @@ export default define(meta, async (ps, user, app) => {
emojis = emojis.concat(extractEmojis(tokens));
}
- if (updates.description != null) {
- const tokens = parse(updates.description);
+ if (profile.description != null) {
+ const tokens = parse(profile.description);
emojis = emojis.concat(extractEmojis(tokens));
tags = extractHashtags(tokens).map(tag => tag.toLowerCase());
}
@@ -221,6 +224,7 @@ export default define(meta, async (ps, user, app) => {
//#endregion
await Users.update(user.id, updates);
+ await UserProfiles.update({ userId: user.id }, profile);
const iObj = await Users.pack(user.id, user, {
detail: true,