aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-30 16:50:12 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-09-04 16:24:58 +0200
commit8424c4026afd7304880a4ce8138a04ffb3d8c938 (patch)
tree5b42625a59307b03333aa7d293b40b4c90da8f73 /server/typings
parentf69ec5f340638ef577e8f5b9b1fb844778656a1f (diff)
downloadPeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.tar.gz
PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.tar.zst
PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.zip
Add auto follow back support for instances
Diffstat (limited to 'server/typings')
-rw-r--r--server/typings/models/account/actor-follow.ts10
-rw-r--r--server/typings/models/account/actor.ts2
-rw-r--r--server/typings/models/user/user-notification.ts11
-rw-r--r--server/typings/models/video/video-blacklist.ts3
-rw-r--r--server/typings/utils.ts9
5 files changed, 22 insertions, 13 deletions
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts
index 17a47b8df..1c66eb0a0 100644
--- a/server/typings/models/account/actor-follow.ts
+++ b/server/typings/models/account/actor-follow.ts
@@ -2,7 +2,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
2import { 2import {
3 MActor, 3 MActor,
4 MActorAccount, 4 MActorAccount,
5 MActorAccountChannel, 5 MActorDefaultAccountChannel,
6 MActorChannelAccountActor, 6 MActorChannelAccountActor,
7 MActorDefault, 7 MActorDefault,
8 MActorFormattable, 8 MActorFormattable,
@@ -37,8 +37,8 @@ export type MActorFollowActorsDefault = MActorFollow &
37 Use<'ActorFollowing', MActorDefault> 37 Use<'ActorFollowing', MActorDefault>
38 38
39export type MActorFollowFull = MActorFollow & 39export type MActorFollowFull = MActorFollow &
40 Use<'ActorFollower', MActorAccountChannel> & 40 Use<'ActorFollower', MActorDefaultAccountChannel> &
41 Use<'ActorFollowing', MActorAccountChannel> 41 Use<'ActorFollowing', MActorDefaultAccountChannel>
42 42
43// ############################################################################ 43// ############################################################################
44 44
@@ -51,10 +51,6 @@ export type MActorFollowActorsDefaultSubscription = MActorFollow &
51 Use<'ActorFollower', MActorDefault> & 51 Use<'ActorFollower', MActorDefault> &
52 Use<'ActorFollowing', SubscriptionFollowing> 52 Use<'ActorFollowing', SubscriptionFollowing>
53 53
54export type MActorFollowFollowingFullFollowerAccount = MActorFollow &
55 Use<'ActorFollower', MActorAccount> &
56 Use<'ActorFollowing', MActorAccountChannel>
57
58export type MActorFollowSubscriptions = MActorFollow & 54export type MActorFollowSubscriptions = MActorFollow &
59 Use<'ActorFollowing', MActorChannelAccountActor> 55 Use<'ActorFollowing', MActorChannelAccountActor>
60 56
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts
index d4bcac4a3..bcacb8351 100644
--- a/server/typings/models/account/actor.ts
+++ b/server/typings/models/account/actor.ts
@@ -58,7 +58,7 @@ export type MActorAccount = MActor &
58export type MActorChannel = MActor & 58export type MActorChannel = MActor &
59 Use<'VideoChannel', MChannel> 59 Use<'VideoChannel', MChannel>
60 60
61export type MActorAccountChannel = MActorAccount & MActorChannel 61export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel
62 62
63export type MActorServer = MActor & 63export type MActorServer = MActor &
64 Use<'Server', MServer> 64 Use<'Server', MServer>
diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts
index f9daf5eb2..1cdc691b0 100644
--- a/server/typings/models/user/user-notification.ts
+++ b/server/typings/models/user/user-notification.ts
@@ -1,5 +1,5 @@
1import { UserNotificationModel } from '../../../models/account/user-notification' 1import { UserNotificationModel } from '../../../models/account/user-notification'
2import { PickWith } from '../../utils' 2import { PickWith, PickWithOpt } from '../../utils'
3import { VideoModel } from '../../../models/video/video' 3import { VideoModel } from '../../../models/video/video'
4import { ActorModel } from '../../../models/activitypub/actor' 4import { ActorModel } from '../../../models/activitypub/actor'
5import { ServerModel } from '../../../models/server/server' 5import { ServerModel } from '../../../models/server/server'
@@ -48,12 +48,13 @@ export namespace UserNotificationIncludes {
48 48
49 export type ActorFollower = Pick<ActorModel, 'preferredUsername' | 'getHost'> & 49 export type ActorFollower = Pick<ActorModel, 'preferredUsername' | 'getHost'> &
50 PickWith<ActorModel, 'Account', AccountInclude> & 50 PickWith<ActorModel, 'Account', AccountInclude> &
51 PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> & 51 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &
52 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> 52 PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>>
53 53
54 export type ActorFollowing = Pick<ActorModel, 'preferredUsername'> & 54 export type ActorFollowing = Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &
55 PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> & 55 PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> &
56 PickWith<ActorModel, 'Account', AccountInclude> 56 PickWith<ActorModel, 'Account', AccountInclude> &
57 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
57 58
58 export type ActorFollowInclude = Pick<ActorFollowModel, 'id' | 'state'> & 59 export type ActorFollowInclude = Pick<ActorFollowModel, 'id' | 'state'> &
59 PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> & 60 PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> &
diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts
index 1dedfa37f..e12880454 100644
--- a/server/typings/models/video/video-blacklist.ts
+++ b/server/typings/models/video/video-blacklist.ts
@@ -13,6 +13,9 @@ export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
13 13
14// ############################################################################ 14// ############################################################################
15 15
16export type MVideoBlacklistLightVideo = MVideoBlacklistLight &
17 Use<'Video', MVideo>
18
16export type MVideoBlacklistVideo = MVideoBlacklist & 19export type MVideoBlacklistVideo = MVideoBlacklist &
17 Use<'Video', MVideo> 20 Use<'Video', MVideo>
18 21
diff --git a/server/typings/utils.ts b/server/typings/utils.ts
index 4b5cf4d7e..1abb4f73e 100644
--- a/server/typings/utils.ts
+++ b/server/typings/utils.ts
@@ -11,3 +11,12 @@ export type PickWith<T, KT extends keyof T, V> = {
11export type PickWithOpt<T, KT extends keyof T, V> = { 11export type PickWithOpt<T, KT extends keyof T, V> = {
12 [P in KT]?: T[P] extends V ? V : never 12 [P in KT]?: T[P] extends V ? V : never
13} 13}
14
15// https://github.com/krzkaczor/ts-essentials Rocks!
16export type DeepPartial<T> = {
17 [P in keyof T]?: T[P] extends Array<infer U>
18 ? Array<DeepPartial<U>>
19 : T[P] extends ReadonlyArray<infer U>
20 ? ReadonlyArray<DeepPartial<U>>
21 : DeepPartial<T[P]>
22};