diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-30 16:50:12 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-09-04 16:24:58 +0200 |
commit | 8424c4026afd7304880a4ce8138a04ffb3d8c938 (patch) | |
tree | 5b42625a59307b03333aa7d293b40b4c90da8f73 /server/typings | |
parent | f69ec5f340638ef577e8f5b9b1fb844778656a1f (diff) | |
download | PeerTube-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.ts | 10 | ||||
-rw-r--r-- | server/typings/models/account/actor.ts | 2 | ||||
-rw-r--r-- | server/typings/models/user/user-notification.ts | 11 | ||||
-rw-r--r-- | server/typings/models/video/video-blacklist.ts | 3 | ||||
-rw-r--r-- | server/typings/utils.ts | 9 |
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' | |||
2 | import { | 2 | import { |
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 | ||
39 | export type MActorFollowFull = MActorFollow & | 39 | export 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 | ||
54 | export type MActorFollowFollowingFullFollowerAccount = MActorFollow & | ||
55 | Use<'ActorFollower', MActorAccount> & | ||
56 | Use<'ActorFollowing', MActorAccountChannel> | ||
57 | |||
58 | export type MActorFollowSubscriptions = MActorFollow & | 54 | export 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 & | |||
58 | export type MActorChannel = MActor & | 58 | export type MActorChannel = MActor & |
59 | Use<'VideoChannel', MChannel> | 59 | Use<'VideoChannel', MChannel> |
60 | 60 | ||
61 | export type MActorAccountChannel = MActorAccount & MActorChannel | 61 | export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel |
62 | 62 | ||
63 | export type MActorServer = MActor & | 63 | export 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 @@ | |||
1 | import { UserNotificationModel } from '../../../models/account/user-notification' | 1 | import { UserNotificationModel } from '../../../models/account/user-notification' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { VideoModel } from '../../../models/video/video' | 3 | import { VideoModel } from '../../../models/video/video' |
4 | import { ActorModel } from '../../../models/activitypub/actor' | 4 | import { ActorModel } from '../../../models/activitypub/actor' |
5 | import { ServerModel } from '../../../models/server/server' | 5 | import { 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 | ||
16 | export type MVideoBlacklistLightVideo = MVideoBlacklistLight & | ||
17 | Use<'Video', MVideo> | ||
18 | |||
16 | export type MVideoBlacklistVideo = MVideoBlacklist & | 19 | export 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> = { | |||
11 | export type PickWithOpt<T, KT extends keyof T, V> = { | 11 | export 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! | ||
16 | export 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 | }; | ||