X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=server%2Fcontrollers%2Fapi%2Fusers.ts;h=2342c23dd683b809ba9db028907033cb382ed04d;hb=ed56ad1193bb5bb0a81fb843a11eb90d3fed9861;hp=6540adb1c1a797f9199a9309bdbc2258bf5c58bd;hpb=0db1a226507a39b0a663e3e63f04851836a44d5a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index 6540adb1c..2342c23dd 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts @@ -7,7 +7,7 @@ import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRat import { retryTransactionWrapper } from '../../helpers/database-utils' import { processImage } from '../../helpers/image-utils' import { logger } from '../../helpers/logger' -import { createReqFiles, getFormattedObjects } from '../../helpers/utils' +import { getFormattedObjects } from '../../helpers/utils' import { AVATARS_SIZE, CONFIG, IMAGE_MIMETYPE_EXT, RATES_LIMIT, sequelizeTypescript } from '../../initializers' import { updateActorAvatarInstance } from '../../lib/activitypub' import { sendUpdateActor } from '../../lib/activitypub/send' @@ -43,6 +43,7 @@ import { UserModel } from '../../models/account/user' import { OAuthTokenModel } from '../../models/oauth/oauth-token' import { VideoModel } from '../../models/video/video' import { VideoSortField } from '../../../client/src/app/shared/video/sort-field.type' +import { createReqFiles } from '../../helpers/express-utils' const reqAvatarFile = createReqFiles([ 'avatarfile' ], IMAGE_MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.AVATARS_DIR }) const loginRateLimiter = new RateLimit({ @@ -184,7 +185,10 @@ async function createUserRetryWrapper (req: express.Request, res: express.Respon return res.json({ user: { id: user.id, - uuid: account.uuid + account: { + id: account.id, + uuid: account.Actor.uuid + } } }).end() } @@ -299,6 +303,7 @@ async function updateMe (req: express.Request, res: express.Response, next: expr await sequelizeTypescript.transaction(async t => { await user.save({ transaction: t }) + if (body.displayName !== undefined) user.Account.name = body.displayName if (body.description !== undefined) user.Account.description = body.description await user.Account.save({ transaction: t })