aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-15 14:46:26 +0100
committerChocobozzz <me@florianbigard.com>2018-02-15 15:29:07 +0100
commit2422c46b27790d94fd29a7092170cee5a1b56008 (patch)
treed5c1942ce20cadb27a551d87c789edfe92f5b105 /server/models/account/account.ts
parent34cbef8c6cc912143a421413bdd832c4adcc556a (diff)
downloadPeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.gz
PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.zst
PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.zip
Implement support field in video and video channel
Diffstat (limited to 'server/models/account/account.ts')
-rw-r--r--server/models/account/account.ts29
1 files changed, 26 insertions, 3 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 20724ae0c..d8f305c37 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -1,16 +1,28 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { 2import {
3 AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Model, Table, 3 AllowNull,
4 BeforeDestroy,
5 BelongsTo,
6 Column,
7 CreatedAt,
8 Default,
9 DefaultScope,
10 ForeignKey,
11 HasMany,
12 Is,
13 Model,
14 Table,
4 UpdatedAt 15 UpdatedAt
5} from 'sequelize-typescript' 16} from 'sequelize-typescript'
6import { Account } from '../../../shared/models/actors' 17import { Account } from '../../../shared/models/actors'
18import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts'
7import { logger } from '../../helpers/logger' 19import { logger } from '../../helpers/logger'
8import { sendDeleteActor } from '../../lib/activitypub/send' 20import { sendDeleteActor } from '../../lib/activitypub/send'
9import { ActorModel } from '../activitypub/actor' 21import { ActorModel } from '../activitypub/actor'
10import { ApplicationModel } from '../application/application' 22import { ApplicationModel } from '../application/application'
11import { AvatarModel } from '../avatar/avatar' 23import { AvatarModel } from '../avatar/avatar'
12import { ServerModel } from '../server/server' 24import { ServerModel } from '../server/server'
13import { getSort } from '../utils' 25import { getSort, throwIfNotValid } from '../utils'
14import { VideoChannelModel } from '../video/video-channel' 26import { VideoChannelModel } from '../video/video-channel'
15import { VideoCommentModel } from '../video/video-comment' 27import { VideoCommentModel } from '../video/video-comment'
16import { UserModel } from './user' 28import { UserModel } from './user'
@@ -42,6 +54,12 @@ export class AccountModel extends Model<AccountModel> {
42 @Column 54 @Column
43 name: string 55 name: string
44 56
57 @AllowNull(true)
58 @Default(null)
59 @Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description'))
60 @Column
61 description: string
62
45 @CreatedAt 63 @CreatedAt
46 createdAt: Date 64 createdAt: Date
47 65
@@ -196,6 +214,7 @@ export class AccountModel extends Model<AccountModel> {
196 const account = { 214 const account = {
197 id: this.id, 215 id: this.id,
198 displayName: this.name, 216 displayName: this.name,
217 description: this.description,
199 createdAt: this.createdAt, 218 createdAt: this.createdAt,
200 updatedAt: this.updatedAt 219 updatedAt: this.updatedAt
201 } 220 }
@@ -204,7 +223,11 @@ export class AccountModel extends Model<AccountModel> {
204 } 223 }
205 224
206 toActivityPubObject () { 225 toActivityPubObject () {
207 return this.Actor.toActivityPubObject(this.name, 'Account') 226 const obj = this.Actor.toActivityPubObject(this.name, 'Account')
227
228 return Object.assign(obj, {
229 summary: this.description
230 })
208 } 231 }
209 232
210 isOwned () { 233 isOwned () {