diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-02-28 08:34:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 08:34:43 +0100 |
commit | d0800f7661f13fabe7bb6f4aa0ea50764f106405 (patch) | |
tree | d43e6b0b6f4a5a32e03487e6464edbcaf288be2a /server/types/models | |
parent | 5cad2ca9db9b9d138f8a33058d10b94a9fd50c69 (diff) | |
download | PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.gz PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.zst PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.zip |
Implement avatar miniatures (#4639)
* client: remove unused file
* refactor(client/my-actor-avatar): size from input
Read size from component input instead of scss, to make it possible to
use smaller avatar images when implemented.
* implement avatar miniatures
close #4560
* fix(test): max file size
* fix(search-index): normalize res acc to avatarMini
* refactor avatars to an array
* client/search: resize channel avatar to 120
* refactor(client/videos): remove unused function
* client(actor-avatar): set default size
* fix tests and avatars full result
When findOne is used only an array containting one avatar is returned.
* update migration version and version notations
* server/search: harmonize normalizing
* Cleanup avatar miniature PR
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/types/models')
-rw-r--r-- | server/types/models/actor/actor-image.ts | 2 | ||||
-rw-r--r-- | server/types/models/actor/actor.ts | 37 | ||||
-rw-r--r-- | server/types/models/user/user-notification.ts | 9 |
3 files changed, 25 insertions, 23 deletions
diff --git a/server/types/models/actor/actor-image.ts b/server/types/models/actor/actor-image.ts index 521b4cc59..e8f32b71e 100644 --- a/server/types/models/actor/actor-image.ts +++ b/server/types/models/actor/actor-image.ts | |||
@@ -9,4 +9,4 @@ export type MActorImage = ActorImageModel | |||
9 | 9 | ||
10 | export type MActorImageFormattable = | 10 | export type MActorImageFormattable = |
11 | FunctionProperties<MActorImage> & | 11 | FunctionProperties<MActorImage> & |
12 | Pick<MActorImage, 'filename' | 'createdAt' | 'updatedAt'> | 12 | Pick<MActorImage, 'width' | 'filename' | 'createdAt' | 'updatedAt'> |
diff --git a/server/types/models/actor/actor.ts b/server/types/models/actor/actor.ts index 9ce97094f..280256bab 100644 --- a/server/types/models/actor/actor.ts +++ b/server/types/models/actor/actor.ts | |||
@@ -10,7 +10,7 @@ type UseOpt<K extends keyof ActorModel, M> = PickWithOpt<ActorModel, K, M> | |||
10 | 10 | ||
11 | // ############################################################################ | 11 | // ############################################################################ |
12 | 12 | ||
13 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server' | 'Banner'> | 13 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'ActorFollowers' | 'Server' | 'Banners'> |
14 | 14 | ||
15 | // ############################################################################ | 15 | // ############################################################################ |
16 | 16 | ||
@@ -35,7 +35,7 @@ export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServ | |||
35 | export type MActorDefaultLight = | 35 | export type MActorDefaultLight = |
36 | MActorLight & | 36 | MActorLight & |
37 | Use<'Server', MServerHost> & | 37 | Use<'Server', MServerHost> & |
38 | Use<'Avatar', MActorImage> | 38 | Use<'Avatars', MActorImage[]> |
39 | 39 | ||
40 | export type MActorAccountId = | 40 | export type MActorAccountId = |
41 | MActor & | 41 | MActor & |
@@ -78,13 +78,13 @@ export type MActorServer = | |||
78 | 78 | ||
79 | export type MActorImages = | 79 | export type MActorImages = |
80 | MActor & | 80 | MActor & |
81 | Use<'Avatar', MActorImage> & | 81 | Use<'Avatars', MActorImage[]> & |
82 | UseOpt<'Banner', MActorImage> | 82 | UseOpt<'Banners', MActorImage[]> |
83 | 83 | ||
84 | export type MActorDefault = | 84 | export type MActorDefault = |
85 | MActor & | 85 | MActor & |
86 | Use<'Server', MServer> & | 86 | Use<'Server', MServer> & |
87 | Use<'Avatar', MActorImage> | 87 | Use<'Avatars', MActorImage[]> |
88 | 88 | ||
89 | export type MActorDefaultChannelId = | 89 | export type MActorDefaultChannelId = |
90 | MActorDefault & | 90 | MActorDefault & |
@@ -93,8 +93,8 @@ export type MActorDefaultChannelId = | |||
93 | export type MActorDefaultBanner = | 93 | export type MActorDefaultBanner = |
94 | MActor & | 94 | MActor & |
95 | Use<'Server', MServer> & | 95 | Use<'Server', MServer> & |
96 | Use<'Avatar', MActorImage> & | 96 | Use<'Avatars', MActorImage[]> & |
97 | Use<'Banner', MActorImage> | 97 | Use<'Banners', MActorImage[]> |
98 | 98 | ||
99 | // Actor with channel that is associated to an account and its actor | 99 | // Actor with channel that is associated to an account and its actor |
100 | // Actor -> VideoChannel -> Account -> Actor | 100 | // Actor -> VideoChannel -> Account -> Actor |
@@ -105,8 +105,8 @@ export type MActorChannelAccountActor = | |||
105 | export type MActorFull = | 105 | export type MActorFull = |
106 | MActor & | 106 | MActor & |
107 | Use<'Server', MServer> & | 107 | Use<'Server', MServer> & |
108 | Use<'Avatar', MActorImage> & | 108 | Use<'Avatars', MActorImage[]> & |
109 | Use<'Banner', MActorImage> & | 109 | Use<'Banners', MActorImage[]> & |
110 | Use<'Account', MAccount> & | 110 | Use<'Account', MAccount> & |
111 | Use<'VideoChannel', MChannelAccountActor> | 111 | Use<'VideoChannel', MChannelAccountActor> |
112 | 112 | ||
@@ -114,8 +114,8 @@ export type MActorFull = | |||
114 | export type MActorFullActor = | 114 | export type MActorFullActor = |
115 | MActor & | 115 | MActor & |
116 | Use<'Server', MServer> & | 116 | Use<'Server', MServer> & |
117 | Use<'Avatar', MActorImage> & | 117 | Use<'Avatars', MActorImage[]> & |
118 | Use<'Banner', MActorImage> & | 118 | Use<'Banners', MActorImage[]> & |
119 | Use<'Account', MAccountDefault> & | 119 | Use<'Account', MAccountDefault> & |
120 | Use<'VideoChannel', MChannelAccountDefault> | 120 | Use<'VideoChannel', MChannelAccountDefault> |
121 | 121 | ||
@@ -125,9 +125,9 @@ export type MActorFullActor = | |||
125 | 125 | ||
126 | export type MActorSummary = | 126 | export type MActorSummary = |
127 | FunctionProperties<MActor> & | 127 | FunctionProperties<MActor> & |
128 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | 128 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId'> & |
129 | Use<'Server', MServerHost> & | 129 | Use<'Server', MServerHost> & |
130 | Use<'Avatar', MActorImage> | 130 | Use<'Avatars', MActorImage[]> |
131 | 131 | ||
132 | export type MActorSummaryBlocks = | 132 | export type MActorSummaryBlocks = |
133 | MActorSummary & | 133 | MActorSummary & |
@@ -145,21 +145,22 @@ export type MActorSummaryFormattable = | |||
145 | FunctionProperties<MActor> & | 145 | FunctionProperties<MActor> & |
146 | Pick<MActor, 'url' | 'preferredUsername'> & | 146 | Pick<MActor, 'url' | 'preferredUsername'> & |
147 | Use<'Server', MServerHost> & | 147 | Use<'Server', MServerHost> & |
148 | Use<'Avatar', MActorImageFormattable> | 148 | Use<'Avatars', MActorImageFormattable[]> |
149 | 149 | ||
150 | export type MActorFormattable = | 150 | export type MActorFormattable = |
151 | MActorSummaryFormattable & | 151 | MActorSummaryFormattable & |
152 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt' | 'remoteCreatedAt' | 'bannerId' | 'avatarId'> & | 152 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt' | 'remoteCreatedAt'> & |
153 | Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> & | 153 | Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> & |
154 | UseOpt<'Banner', MActorImageFormattable> | 154 | UseOpt<'Banners', MActorImageFormattable[]> & |
155 | UseOpt<'Avatars', MActorImageFormattable[]> | ||
155 | 156 | ||
156 | type MActorAPBase = | 157 | type MActorAPBase = |
157 | MActor & | 158 | MActor & |
158 | Use<'Avatar', MActorImage> | 159 | Use<'Avatars', MActorImage[]> |
159 | 160 | ||
160 | export type MActorAPAccount = | 161 | export type MActorAPAccount = |
161 | MActorAPBase | 162 | MActorAPBase |
162 | 163 | ||
163 | export type MActorAPChannel = | 164 | export type MActorAPChannel = |
164 | MActorAPBase & | 165 | MActorAPBase & |
165 | Use<'Banner', MActorImage> | 166 | Use<'Banners', MActorImage[]> |
diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts index db9ec0400..d4715a0b6 100644 --- a/server/types/models/user/user-notification.ts +++ b/server/types/models/user/user-notification.ts | |||
@@ -21,6 +21,7 @@ type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationMo | |||
21 | // ############################################################################ | 21 | // ############################################################################ |
22 | 22 | ||
23 | export module UserNotificationIncludes { | 23 | export module UserNotificationIncludes { |
24 | export type ActorImageInclude = Pick<ActorImageModel, 'createdAt' | 'filename' | 'getStaticPath' | 'width' | 'updatedAt'> | ||
24 | 25 | ||
25 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> | 26 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> |
26 | export type VideoIncludeChannel = | 27 | export type VideoIncludeChannel = |
@@ -29,7 +30,7 @@ export module UserNotificationIncludes { | |||
29 | 30 | ||
30 | export type ActorInclude = | 31 | export type ActorInclude = |
31 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & | 32 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & |
32 | PickWith<ActorModel, 'Avatar', Pick<ActorImageModel, 'filename' | 'getStaticPath'>> & | 33 | PickWith<ActorModel, 'Avatars', ActorImageInclude[]> & |
33 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> | 34 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> |
34 | 35 | ||
35 | export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'> | 36 | export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'> |
@@ -75,7 +76,7 @@ export module UserNotificationIncludes { | |||
75 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & | 76 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & |
76 | PickWith<ActorModel, 'Account', AccountInclude> & | 77 | PickWith<ActorModel, 'Account', AccountInclude> & |
77 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> & | 78 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> & |
78 | PickWithOpt<ActorModel, 'Avatar', Pick<ActorImageModel, 'filename' | 'getStaticPath'>> | 79 | PickWithOpt<ActorModel, 'Avatars', ActorImageInclude[]> |
79 | 80 | ||
80 | export type ActorFollowing = | 81 | export type ActorFollowing = |
81 | Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> & | 82 | Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> & |
@@ -98,7 +99,7 @@ export module UserNotificationIncludes { | |||
98 | // ############################################################################ | 99 | // ############################################################################ |
99 | 100 | ||
100 | export type MUserNotification = | 101 | export type MUserNotification = |
101 | Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'Abuse' | 'VideoBlacklist' | | 102 | Omit<UserNotificationModel, 'User' | 'Video' | 'VideoComment' | 'Abuse' | 'VideoBlacklist' | |
102 | 'VideoImport' | 'Account' | 'ActorFollow' | 'Plugin' | 'Application'> | 103 | 'VideoImport' | 'Account' | 'ActorFollow' | 'Plugin' | 'Application'> |
103 | 104 | ||
104 | // ############################################################################ | 105 | // ############################################################################ |
@@ -106,7 +107,7 @@ export type MUserNotification = | |||
106 | export type UserNotificationModelForApi = | 107 | export type UserNotificationModelForApi = |
107 | MUserNotification & | 108 | MUserNotification & |
108 | Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & | 109 | Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & |
109 | Use<'Comment', UserNotificationIncludes.VideoCommentInclude> & | 110 | Use<'VideoComment', UserNotificationIncludes.VideoCommentInclude> & |
110 | Use<'Abuse', UserNotificationIncludes.AbuseInclude> & | 111 | Use<'Abuse', UserNotificationIncludes.AbuseInclude> & |
111 | Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> & | 112 | Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> & |
112 | Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> & | 113 | Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> & |