From 5291ac247864ce318fecec31c89365b8015d3de4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Aug 2024 10:56:35 +0200 Subject: [PATCH] Remove useless option See https://blog.angular.dev/using-isolatedmodules-in-angular-18-2-68a7d3a6c03d --- .../video-channel-update.component.ts | 20 +++++++++---------- .../my-video-playlist-edit.ts | 5 +++-- .../my-video-playlist-update.component.ts | 18 ++++++++--------- .../video-channel/video-channel.model.ts | 6 ++---- .../shared-main/video/video-details.model.ts | 15 +++++++------- client/tsconfig.json | 3 +-- 6 files changed, 31 insertions(+), 36 deletions(-) diff --git a/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts b/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts index 89488a4c145..9bb4730bd0b 100644 --- a/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts +++ b/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts @@ -1,6 +1,7 @@ -import { Subscription } from 'rxjs' +import { NgClass, NgIf } from '@angular/common' import { HttpErrorResponse } from '@angular/common/http' import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core' +import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { ActivatedRoute } from '@angular/router' import { AuthService, HooksService, Notifier, RedirectService } from '@app/core' import { genericUploadErrorHandler } from '@app/helpers' @@ -10,18 +11,16 @@ import { VIDEO_CHANNEL_SUPPORT_VALIDATOR } from '@app/shared/form-validators/video-channel-validators' import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service' -import { VideoChannelUpdate } from '@peertube/peertube-models' -import { VideoChannelEdit } from './video-channel-edit' +import { VideoChannelService } from '@app/shared/shared-main/video-channel/video-channel.service' import { shallowCopy } from '@peertube/peertube-core-utils' -import { PeertubeCheckboxComponent } from '../../shared/shared-forms/peertube-checkbox.component' -import { MarkdownTextareaComponent } from '../../shared/shared-forms/markdown-textarea.component' -import { HelpComponent } from '../../shared/shared-main/misc/help.component' +import { VideoChannelUpdate } from '@peertube/peertube-models' +import { Subscription } from 'rxjs' import { ActorAvatarEditComponent } from '../../shared/shared-actor-image-edit/actor-avatar-edit.component' import { ActorBannerEditComponent } from '../../shared/shared-actor-image-edit/actor-banner-edit.component' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { NgIf, NgClass } from '@angular/common' -import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model' -import { VideoChannelService } from '@app/shared/shared-main/video-channel/video-channel.service' +import { MarkdownTextareaComponent } from '../../shared/shared-forms/markdown-textarea.component' +import { PeertubeCheckboxComponent } from '../../shared/shared-forms/peertube-checkbox.component' +import { HelpComponent } from '../../shared/shared-main/misc/help.component' +import { VideoChannelEdit } from './video-channel-edit' @Component({ selector: 'my-video-channel-update', @@ -42,7 +41,6 @@ import { VideoChannelService } from '@app/shared/shared-main/video-channel/video }) export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnInit, AfterViewInit, OnDestroy { error: string - videoChannel: VideoChannel private paramsSub: Subscription private oldSupportField: string diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts index 8af71db98ec..0757b2369bd 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts @@ -1,6 +1,7 @@ -import { VideoConstant, VideoPlaylist, VideoPlaylistPrivacyType } from '@peertube/peertube-models' -import { SelectChannelItem } from '../../../types/select-options-item.model' import { FormReactive } from '@app/shared/shared-forms/form-reactive' +import { VideoPlaylist } from '@app/shared/shared-video-playlist/video-playlist.model' +import { VideoConstant, VideoPlaylistPrivacyType } from '@peertube/peertube-models' +import { SelectChannelItem } from '../../../types/select-options-item.model' export abstract class MyVideoPlaylistEdit extends FormReactive { // Declare it here to avoid errors in create template diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts index 14e1c3b9f3c..a4e26656128 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts @@ -1,6 +1,6 @@ -import { forkJoin, Subscription } from 'rxjs' -import { map, switchMap } from 'rxjs/operators' +import { NgClass, NgIf } from '@angular/common' import { Component, OnDestroy, OnInit } from '@angular/core' +import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { ActivatedRoute, Router, RouterLink } from '@angular/router' import { AuthService, Notifier, ServerService } from '@app/core' import { listUserChannelsForSelect } from '@app/helpers' @@ -12,17 +12,16 @@ import { VIDEO_PLAYLIST_PRIVACY_VALIDATOR } from '@app/shared/form-validators/video-playlist-validators' import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service' +import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service' import { VideoPlaylistUpdate } from '@peertube/peertube-models' -import { MyVideoPlaylistEdit } from './my-video-playlist-edit' +import { forkJoin, Subscription } from 'rxjs' +import { map, switchMap } from 'rxjs/operators' +import { MarkdownTextareaComponent } from '../../shared/shared-forms/markdown-textarea.component' +import { PreviewUploadComponent } from '../../shared/shared-forms/preview-upload.component' import { SelectChannelComponent } from '../../shared/shared-forms/select/select-channel.component' import { SelectOptionsComponent } from '../../shared/shared-forms/select/select-options.component' -import { MarkdownTextareaComponent } from '../../shared/shared-forms/markdown-textarea.component' import { HelpComponent } from '../../shared/shared-main/misc/help.component' -import { PreviewUploadComponent } from '../../shared/shared-forms/preview-upload.component' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { NgIf, NgClass } from '@angular/common' -import { VideoPlaylist } from '@app/shared/shared-video-playlist/video-playlist.model' -import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service' +import { MyVideoPlaylistEdit } from './my-video-playlist-edit' @Component({ templateUrl: './my-video-playlist-edit.component.html', @@ -43,7 +42,6 @@ import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-pl }) export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implements OnInit, OnDestroy { error: string - videoPlaylistToUpdate: VideoPlaylist private paramsSub: Subscription diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts index 4cbb5ac95ea..6fae772d75a 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts @@ -1,15 +1,13 @@ import { getAbsoluteAPIUrl } from '@app/helpers' -import { Account as ServerAccount, ActorImage, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@peertube/peertube-models' -import { Actor } from '../account/actor.model' import { maxBy } from '@peertube/peertube-core-utils' +import { ActorImage, Account as ServerAccount, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@peertube/peertube-models' +import { Actor } from '../account/actor.model' export class VideoChannel extends Actor implements ServerVideoChannel { displayName: string description: string support: string - isLocal: boolean - nameWithHost: string nameWithHostForced: string diff --git a/client/src/app/shared/shared-main/video/video-details.model.ts b/client/src/app/shared/shared-main/video/video-details.model.ts index 2ec081fe9b6..11ad6adb197 100644 --- a/client/src/app/shared/shared-main/video/video-details.model.ts +++ b/client/src/app/shared/shared-main/video/video-details.model.ts @@ -12,16 +12,14 @@ import { import { Video } from './video.model' export class VideoDetails extends Video implements VideoDetailsServerModel { + declare channel: VideoChannel + declare account: Account + descriptionPath: string support: string - channel: VideoChannel tags: string[] - account: Account downloadEnabled: boolean - waitTranscoding: boolean - state: VideoConstant - commentsEnabled: never commentsPolicy: VideoConstant @@ -32,8 +30,11 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { inputFileUpdatedAt: Date | string - files: VideoFile[] - streamingPlaylists: VideoStreamingPlaylist[] + // These fields are not optional + declare files: VideoFile[] + declare streamingPlaylists: VideoStreamingPlaylist[] + declare waitTranscoding: boolean + declare state: VideoConstant constructor (hash: VideoDetailsServerModel, translations = {}) { super(hash, translations) diff --git a/client/tsconfig.json b/client/tsconfig.json index a1afdd2b021..7ee9ab6e456 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -44,8 +44,7 @@ "crypto": [ "src/shims/noop.ts" ] - }, - "useDefineForClassFields": false + } }, "references": [ { "path": "../packages/core-utils" },