From 43df00a30dc07ec6fc1b30d41eac011e4ea8641b Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Mon, 6 Dec 2021 05:54:26 +0100 Subject: [PATCH] give admins access to edit all channels closes #4598 --- .../my-video-channel-edit.component.html | 112 ------------------ .../my-video-channels-routing.module.ts | 20 ---- .../my-video-channels.component.html | 4 +- .../my-video-channels.module.ts | 8 +- .../video-channel-create.component.ts} | 6 +- .../video-channel-edit.component.html | 96 +++++++++++++++ .../video-channel-edit.component.scss} | 4 + .../video-channel-edit/video-channel-edit.ts} | 0 .../video-channel-update.component.ts} | 14 +-- .../video-channels-routing.module.ts | 21 ++++ .../video-channels.component.html | 4 +- .../video-channels.component.ts | 8 +- .../+video-channels/video-channels.module.ts | 10 +- server/controllers/api/video-channel.ts | 11 +- server/middlewares/user-right.ts | 20 +++- shared/models/users/user-right.enum.ts | 4 +- 16 files changed, 178 insertions(+), 164 deletions(-) delete mode 100644 client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.html rename client/src/app/{+my-library/+my-video-channels/my-video-channel-create.component.ts => +video-channels/video-channel-edit/video-channel-create.component.ts} (94%) create mode 100644 client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.html rename client/src/app/{+my-library/+my-video-channels/my-video-channel-edit.component.scss => +video-channels/video-channel-edit/video-channel-edit.component.scss} (96%) rename client/src/app/{+my-library/+my-video-channels/my-video-channel-edit.ts => +video-channels/video-channel-edit/video-channel-edit.ts} (100%) rename client/src/app/{+my-library/+my-video-channels/my-video-channel-update.component.ts => +video-channels/video-channel-edit/video-channel-update.component.ts} (92%) diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.html b/client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.html deleted file mode 100644 index 2910dffad..000000000 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.html +++ /dev/null @@ -1,112 +0,0 @@ - - -
{{ error }}
- -
- -
-
-
NEW CHANNEL
-
CHANNEL
-
- -
-
Banner image of your channel
- - - - - -
- -
- -
- @{{ instanceHost }} -
-
-
- {{ formErrors['name'] }} -
-
- -
- - -
- {{ formErrors['display-name'] }} -
-
- -
- - -
- {{ formErrors.description }} -
-
- -
- - - -
- {{ formErrors.support }} -
-
- -
- -
- -
-
- -
-
-
- -
-
-
diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels-routing.module.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels-routing.module.ts index 6b8efad0b..f103bacc4 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels-routing.module.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels-routing.module.ts @@ -1,7 +1,5 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' -import { MyVideoChannelUpdateComponent } from './my-video-channel-update.component' -import { MyVideoChannelCreateComponent } from './my-video-channel-create.component' import { MyVideoChannelsComponent } from './my-video-channels.component' const myVideoChannelsRoutes: Routes = [ @@ -13,24 +11,6 @@ const myVideoChannelsRoutes: Routes = [ title: $localize`My video channels` } } - }, - { - path: 'create', - component: MyVideoChannelCreateComponent, - data: { - meta: { - title: $localize`Create a new video channel` - } - } - }, - { - path: 'update/:videoChannelId', - component: MyVideoChannelUpdateComponent, - data: { - meta: { - title: $localize`Update video channel` - } - } } ] diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html index bbe583971..92e2345ab 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.html @@ -9,7 +9,7 @@
- + Create video channel @@ -37,7 +37,7 @@
{videoChannel.videosCount, plural, =0 {No videos} =1 {1 video} other {{{ videoChannel.videosCount }} videos}}
- +
diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.module.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels.module.ts index c775bfdee..a17eb9f10 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.module.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.module.ts @@ -1,11 +1,8 @@ import { ChartModule } from 'primeng/chart' import { NgModule } from '@angular/core' -import { SharedActorImageEditModule } from '@app/shared/shared-actor-image-edit' import { SharedFormModule } from '@app/shared/shared-forms' import { SharedGlobalIconModule } from '@app/shared/shared-icons' import { SharedMainModule } from '@app/shared/shared-main' -import { MyVideoChannelCreateComponent } from './my-video-channel-create.component' -import { MyVideoChannelUpdateComponent } from './my-video-channel-update.component' import { MyVideoChannelsRoutingModule } from './my-video-channels-routing.module' import { MyVideoChannelsComponent } from './my-video-channels.component' import { SharedActorImageModule } from '@app/shared/shared-actor-image/shared-actor-image.module' @@ -19,14 +16,11 @@ import { SharedActorImageModule } from '@app/shared/shared-actor-image/shared-ac SharedMainModule, SharedFormModule, SharedGlobalIconModule, - SharedActorImageEditModule, SharedActorImageModule ], declarations: [ - MyVideoChannelsComponent, - MyVideoChannelCreateComponent, - MyVideoChannelUpdateComponent + MyVideoChannelsComponent ], exports: [], diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts b/client/src/app/+video-channels/video-channel-edit/video-channel-create.component.ts similarity index 94% rename from client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts rename to client/src/app/+video-channels/video-channel-edit/video-channel-create.component.ts index fd00720d8..a7b365dbf 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts +++ b/client/src/app/+video-channels/video-channel-edit/video-channel-create.component.ts @@ -12,11 +12,11 @@ import { import { FormValidatorService } from '@app/shared/shared-forms' import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { HttpStatusCode, VideoChannelCreate } from '@shared/models' -import { MyVideoChannelEdit } from './my-video-channel-edit' +import { MyVideoChannelEdit } from './video-channel-edit' @Component({ - templateUrl: './my-video-channel-edit.component.html', - styleUrls: [ './my-video-channel-edit.component.scss' ] + templateUrl: './video-channel-edit.component.html', + styleUrls: [ './video-channel-edit.component.scss' ] }) export class MyVideoChannelCreateComponent extends MyVideoChannelEdit implements OnInit { error: string diff --git a/client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.html b/client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.html new file mode 100644 index 000000000..3751747a9 --- /dev/null +++ b/client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.html @@ -0,0 +1,96 @@ +
{{ error }}
+ +
+
+ +
+
+
NEW CHANNEL
+
CHANNEL
+
+ +
+
Banner image of the channel
+ + + + + +
+ +
+ +
+ @{{ instanceHost }} +
+
+
+ {{ formErrors['name'] }} +
+
+ +
+ + +
+ {{ formErrors['display-name'] }} +
+
+ +
+ + +
+ {{ formErrors.description }} +
+
+ +
+ + + +
+ {{ formErrors.support }} +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.scss b/client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.scss similarity index 96% rename from client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.scss rename to client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.scss index d8bfe71b6..d010d6277 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-edit.component.scss +++ b/client/src/app/+video-channels/video-channel-edit/video-channel-edit.component.scss @@ -1,6 +1,10 @@ @use '_variables' as *; @use '_mixins' as *; +.margin-content { + padding-top: 20px; +} + label { font-weight: $font-regular; font-size: 100%; diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-edit.ts b/client/src/app/+video-channels/video-channel-edit/video-channel-edit.ts similarity index 100% rename from client/src/app/+my-library/+my-video-channels/my-video-channel-edit.ts rename to client/src/app/+video-channels/video-channel-edit/video-channel-edit.ts diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts b/client/src/app/+video-channels/video-channel-edit/video-channel-update.component.ts similarity index 92% rename from client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts rename to client/src/app/+video-channels/video-channel-edit/video-channel-update.component.ts index f9521b8b5..96cb4c6b6 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts +++ b/client/src/app/+video-channels/video-channel-edit/video-channel-update.component.ts @@ -12,14 +12,14 @@ import { import { FormValidatorService } from '@app/shared/shared-forms' import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' import { HTMLServerConfig, VideoChannelUpdate } from '@shared/models' -import { MyVideoChannelEdit } from './my-video-channel-edit' +import { MyVideoChannelEdit } from './video-channel-edit' @Component({ selector: 'my-video-channel-update', - templateUrl: './my-video-channel-edit.component.html', - styleUrls: [ './my-video-channel-edit.component.scss' ] + templateUrl: './video-channel-edit.component.html', + styleUrls: [ './video-channel-edit.component.scss' ] }) -export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements OnInit, OnDestroy { +export class VideoChannelUpdateComponent extends MyVideoChannelEdit implements OnInit, OnDestroy { error: string videoChannel: VideoChannel @@ -50,9 +50,9 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements }) this.paramsSub = this.route.params.subscribe(routeParams => { - const videoChannelId = routeParams['videoChannelId'] + const videoChannelName = routeParams['videoChannelName'] - this.videoChannelService.getVideoChannel(videoChannelId) + this.videoChannelService.getVideoChannel(videoChannelName) .subscribe({ next: videoChannelToUpdate => { this.videoChannel = videoChannelToUpdate @@ -95,7 +95,7 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`) - this.router.navigate([ '/my-library', 'video-channels' ]) + this.router.navigate([ '/c', this.videoChannel.name ]) }, error: err => { diff --git a/client/src/app/+video-channels/video-channels-routing.module.ts b/client/src/app/+video-channels/video-channels-routing.module.ts index 4ee052873..ae5c601a3 100644 --- a/client/src/app/+video-channels/video-channels-routing.module.ts +++ b/client/src/app/+video-channels/video-channels-routing.module.ts @@ -1,10 +1,21 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' +import { MyVideoChannelCreateComponent } from './video-channel-edit/video-channel-create.component' +import { VideoChannelUpdateComponent } from './video-channel-edit/video-channel-update.component' import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-channel-playlists.component' import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component' import { VideoChannelsComponent } from './video-channels.component' const videoChannelsRoutes: Routes = [ + { + path: '@create', + component: MyVideoChannelCreateComponent, + data: { + meta: { + title: $localize`Create a new video channel` + } + } + }, { path: ':videoChannelName', component: VideoChannelsComponent, @@ -37,6 +48,16 @@ const videoChannelsRoutes: Routes = [ } } ] + }, + { + path: ':videoChannelName/update', + component: VideoChannelUpdateComponent, + + data: { + meta: { + title: $localize`Update video channel` + } + } } ] diff --git a/client/src/app/+video-channels/video-channels.component.html b/client/src/app/+video-channels/video-channels.component.html index 064fbb6f5..861a51574 100644 --- a/client/src/app/+video-channels/video-channels.component.html +++ b/client/src/app/+video-channels/video-channels.component.html @@ -6,11 +6,11 @@
- + Manage channel - +