diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/account.ts | 32 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 5 |
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 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequelize' | ||
1 | import { | 3 | import { |
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' |
20 | import { ModelCache } from '@server/models/model-cache' | ||
18 | import { Account, AccountSummary } from '../../../shared/models/actors' | 21 | import { Account, AccountSummary } from '../../../shared/models/actors' |
19 | import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' | 22 | import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' |
23 | import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants' | ||
20 | import { sendDeleteActor } from '../../lib/activitypub/send' | 24 | import { sendDeleteActor } from '../../lib/activitypub/send' |
25 | import { | ||
26 | MAccount, | ||
27 | MAccountActor, | ||
28 | MAccountAP, | ||
29 | MAccountDefault, | ||
30 | MAccountFormattable, | ||
31 | MAccountSummaryFormattable, | ||
32 | MChannelActor | ||
33 | } from '../../types/models' | ||
21 | import { ActorModel } from '../activitypub/actor' | 34 | import { ActorModel } from '../activitypub/actor' |
35 | import { ActorFollowModel } from '../activitypub/actor-follow' | ||
22 | import { ApplicationModel } from '../application/application' | 36 | import { ApplicationModel } from '../application/application' |
37 | import { AvatarModel } from '../avatar/avatar' | ||
23 | import { ServerModel } from '../server/server' | 38 | import { ServerModel } from '../server/server' |
39 | import { ServerBlocklistModel } from '../server/server-blocklist' | ||
24 | import { getSort, throwIfNotValid } from '../utils' | 40 | import { getSort, throwIfNotValid } from '../utils' |
41 | import { VideoModel } from '../video/video' | ||
25 | import { VideoChannelModel } from '../video/video-channel' | 42 | import { VideoChannelModel } from '../video/video-channel' |
26 | import { VideoCommentModel } from '../video/video-comment' | 43 | import { VideoCommentModel } from '../video/video-comment' |
27 | import { UserModel } from './user' | ||
28 | import { AvatarModel } from '../avatar/avatar' | ||
29 | import { VideoPlaylistModel } from '../video/video-playlist' | 44 | import { VideoPlaylistModel } from '../video/video-playlist' |
30 | import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants' | ||
31 | import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequelize' | ||
32 | import { AccountBlocklistModel } from './account-blocklist' | 45 | import { AccountBlocklistModel } from './account-blocklist' |
33 | import { ServerBlocklistModel } from '../server/server-blocklist' | 46 | import { UserModel } from './user' |
34 | import { ActorFollowModel } from '../activitypub/actor-follow' | ||
35 | import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../types/models' | ||
36 | import * as Bluebird from 'bluebird' | ||
37 | import { ModelCache } from '@server/models/model-cache' | ||
38 | import { VideoModel } from '../video/video' | ||
39 | 47 | ||
40 | export enum ScopeNames { | 48 | export 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' |
21 | import { MAccountActor } from '@server/types/models' | ||
21 | import { ActivityPubActor } from '../../../shared/models/activitypub' | 22 | import { ActivityPubActor } from '../../../shared/models/activitypub' |
22 | import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos' | 23 | import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos' |
23 | import { | 24 | import { |
@@ -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 | } |