aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/account.ts32
-rw-r--r--server/models/video/video-channel.ts5
2 files changed, 27 insertions, 10 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 1162643be..8c244d432 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -1,3 +1,5 @@
1import * as Bluebird from 'bluebird'
2import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequelize'
1import { 3import {
2 AllowNull, 4 AllowNull,
3 BeforeDestroy, 5 BeforeDestroy,
@@ -15,27 +17,33 @@ import {
15 Table, 17 Table,
16 UpdatedAt 18 UpdatedAt
17} from 'sequelize-typescript' 19} from 'sequelize-typescript'
20import { ModelCache } from '@server/models/model-cache'
18import { Account, AccountSummary } from '../../../shared/models/actors' 21import { Account, AccountSummary } from '../../../shared/models/actors'
19import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' 22import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts'
23import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants'
20import { sendDeleteActor } from '../../lib/activitypub/send' 24import { sendDeleteActor } from '../../lib/activitypub/send'
25import {
26 MAccount,
27 MAccountActor,
28 MAccountAP,
29 MAccountDefault,
30 MAccountFormattable,
31 MAccountSummaryFormattable,
32 MChannelActor
33} from '../../types/models'
21import { ActorModel } from '../activitypub/actor' 34import { ActorModel } from '../activitypub/actor'
35import { ActorFollowModel } from '../activitypub/actor-follow'
22import { ApplicationModel } from '../application/application' 36import { ApplicationModel } from '../application/application'
37import { AvatarModel } from '../avatar/avatar'
23import { ServerModel } from '../server/server' 38import { ServerModel } from '../server/server'
39import { ServerBlocklistModel } from '../server/server-blocklist'
24import { getSort, throwIfNotValid } from '../utils' 40import { getSort, throwIfNotValid } from '../utils'
41import { VideoModel } from '../video/video'
25import { VideoChannelModel } from '../video/video-channel' 42import { VideoChannelModel } from '../video/video-channel'
26import { VideoCommentModel } from '../video/video-comment' 43import { VideoCommentModel } from '../video/video-comment'
27import { UserModel } from './user'
28import { AvatarModel } from '../avatar/avatar'
29import { VideoPlaylistModel } from '../video/video-playlist' 44import { VideoPlaylistModel } from '../video/video-playlist'
30import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants'
31import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequelize'
32import { AccountBlocklistModel } from './account-blocklist' 45import { AccountBlocklistModel } from './account-blocklist'
33import { ServerBlocklistModel } from '../server/server-blocklist' 46import { UserModel } from './user'
34import { ActorFollowModel } from '../activitypub/actor-follow'
35import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../types/models'
36import * as Bluebird from 'bluebird'
37import { ModelCache } from '@server/models/model-cache'
38import { VideoModel } from '../video/video'
39 47
40export enum ScopeNames { 48export enum ScopeNames {
41 SUMMARY = 'SUMMARY' 49 SUMMARY = 'SUMMARY'
@@ -441,6 +449,10 @@ export class AccountModel extends Model<AccountModel> {
441 return this.name 449 return this.name
442 } 450 }
443 451
452 getLocalUrl (this: MAccountActor | MChannelActor) {
453 return WEBSERVER.URL + `/accounts/` + this.Actor.preferredUsername
454 }
455
444 isBlocked () { 456 isBlocked () {
445 return this.BlockedAccounts && this.BlockedAccounts.length !== 0 457 return this.BlockedAccounts && this.BlockedAccounts.length !== 0
446 } 458 }
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 202dc513f..0c8aef18f 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -18,6 +18,7 @@ import {
18 Table, 18 Table,
19 UpdatedAt 19 UpdatedAt
20} from 'sequelize-typescript' 20} from 'sequelize-typescript'
21import { MAccountActor } from '@server/types/models'
21import { ActivityPubActor } from '../../../shared/models/activitypub' 22import { ActivityPubActor } from '../../../shared/models/activitypub'
22import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos' 23import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos'
23import { 24import {
@@ -628,6 +629,10 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
628 }) 629 })
629 } 630 }
630 631
632 getLocalUrl (this: MAccountActor | MChannelActor) {
633 return WEBSERVER.URL + `/video-channels/` + this.Actor.preferredUsername
634 }
635
631 getDisplayName () { 636 getDisplayName () {
632 return this.name 637 return this.name
633 } 638 }