diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-07 17:01:29 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-04-08 10:07:53 +0200 |
commit | cdeddff142fd20f8cb8bb346625909d61c596603 (patch) | |
tree | e7b0ae302a002fb2eadc605300294a1f135c3744 /server/models/account | |
parent | 282695e699a35b65441b548061ef0db5de9b3971 (diff) | |
download | PeerTube-cdeddff142fd20f8cb8bb346625909d61c596603.tar.gz PeerTube-cdeddff142fd20f8cb8bb346625909d61c596603.tar.zst PeerTube-cdeddff142fd20f8cb8bb346625909d61c596603.zip |
Add ability to update the banner
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/actor-image.ts | 6 | ||||
-rw-r--r-- | server/models/account/user.ts | 16 |
2 files changed, 20 insertions, 2 deletions
diff --git a/server/models/account/actor-image.ts b/server/models/account/actor-image.ts index c532bd08d..b779e3cf6 100644 --- a/server/models/account/actor-image.ts +++ b/server/models/account/actor-image.ts | |||
@@ -72,7 +72,11 @@ export class ActorImageModel extends Model { | |||
72 | } | 72 | } |
73 | 73 | ||
74 | getStaticPath () { | 74 | getStaticPath () { |
75 | return join(LAZY_STATIC_PATHS.AVATARS, this.filename) | 75 | if (this.type === ActorImageType.AVATAR) { |
76 | return join(LAZY_STATIC_PATHS.AVATARS, this.filename) | ||
77 | } | ||
78 | |||
79 | return join(LAZY_STATIC_PATHS.BANNERS, this.filename) | ||
76 | } | 80 | } |
77 | 81 | ||
78 | getPath () { | 82 | getPath () { |
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index a7a65c489..00c6d73aa 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -71,6 +71,7 @@ import { VideoLiveModel } from '../video/video-live' | |||
71 | import { VideoPlaylistModel } from '../video/video-playlist' | 71 | import { VideoPlaylistModel } from '../video/video-playlist' |
72 | import { AccountModel } from './account' | 72 | import { AccountModel } from './account' |
73 | import { UserNotificationSettingModel } from './user-notification-setting' | 73 | import { UserNotificationSettingModel } from './user-notification-setting' |
74 | import { ActorImageModel } from './actor-image' | ||
74 | 75 | ||
75 | enum ScopeNames { | 76 | enum ScopeNames { |
76 | FOR_ME_API = 'FOR_ME_API', | 77 | FOR_ME_API = 'FOR_ME_API', |
@@ -97,7 +98,20 @@ enum ScopeNames { | |||
97 | model: AccountModel, | 98 | model: AccountModel, |
98 | include: [ | 99 | include: [ |
99 | { | 100 | { |
100 | model: VideoChannelModel | 101 | model: VideoChannelModel.unscoped(), |
102 | include: [ | ||
103 | { | ||
104 | model: ActorModel, | ||
105 | required: true, | ||
106 | include: [ | ||
107 | { | ||
108 | model: ActorImageModel, | ||
109 | as: 'Banner', | ||
110 | required: false | ||
111 | } | ||
112 | ] | ||
113 | } | ||
114 | ] | ||
101 | }, | 115 | }, |
102 | { | 116 | { |
103 | attributes: [ 'id', 'name', 'type' ], | 117 | attributes: [ 'id', 'name', 'type' ], |