From 79bd2632d62f2f600d663815fcc00a01ca981aa1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Oct 2018 16:56:14 +0200 Subject: Add user moderation in the account page --- server/models/account/account.ts | 3 ++- server/models/video/video-format-utils.ts | 2 +- server/models/video/video.ts | 1 - server/tests/api/users/users-multiple-servers.ts | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 27c75d886..5a237d733 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -248,7 +248,8 @@ export class AccountModel extends Model { displayName: this.getDisplayName(), description: this.description, createdAt: this.createdAt, - updatedAt: this.updatedAt + updatedAt: this.updatedAt, + userId: this.userId ? this.userId : undefined } return Object.assign(actor, account) diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 78972b199..905e84449 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -10,7 +10,7 @@ import { getVideoLikesActivityPubUrl, getVideoSharesActivityPubUrl } from '../../lib/activitypub' -import { isArray } from 'util' +import { isArray } from '../../helpers/custom-validators/misc' export type VideoFormattingJSONOptions = { completeDescription?: boolean diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 0a2d7e6de..46d823240 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -94,7 +94,6 @@ import { import * as validator from 'validator' import { UserVideoHistoryModel } from '../account/user-video-history' - // FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation const indexes: Sequelize.DefineIndexesOptions[] = [ buildTrigramSearchIndex('video_name_trigram', 'name'), diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index b67072851..d8699db17 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -148,6 +148,12 @@ describe('Test users with multiple servers', function () { expect(rootServer1Get.displayName).to.equal('my super display name') expect(rootServer1Get.description).to.equal('my super description updated') + if (server.serverNumber === 1) { + expect(rootServer1Get.userId).to.be.a('number') + } else { + expect(rootServer1Get.userId).to.be.undefined + } + await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png') } }) -- cgit v1.2.3