From 3cac8a756f693e02cdce7be8f878b73cb0657477 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Feb 2024 11:12:05 +0100 Subject: [PATCH] Fix lint, tests and styling --- .../my-account-import-export.component.scss | 2 -- .../my-account-import-export.component.ts | 13 ++++++------- .../my-account-import.component.html | 3 +-- client/src/app/+my-account/my-account.component.ts | 7 ++----- packages/models/src/server/server-config.model.ts | 2 +- .../server-commands/src/videos/videos-command.ts | 9 +++++---- packages/tests/src/api/check-params/user-import.ts | 2 +- packages/tests/src/shared/videos.ts | 4 ++-- server/core/models/video/video-playlist-element.ts | 3 ++- 9 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 client/src/app/+my-account/my-account-import-export/my-account-import-export.component.scss diff --git a/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.scss b/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.scss deleted file mode 100644 index 40083bed3..000000000 --- a/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.scss +++ /dev/null @@ -1,2 +0,0 @@ -@use '_variables' as *; -@use '_mixins' as *; diff --git a/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.ts b/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.ts index 9b571f1b1..271f13398 100644 --- a/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.ts +++ b/client/src/app/+my-account/my-account-import-export/my-account-import-export.component.ts @@ -5,8 +5,7 @@ import { first } from 'rxjs' @Component({ selector: 'my-account-import-export', - templateUrl: './my-account-import-export.component.html', - styleUrls: [ './my-account-import-export.component.scss' ] + templateUrl: './my-account-import-export.component.html' }) export class MyAccountImportExportComponent implements OnInit, CanComponentDeactivate { @ViewChild('accountImport') accountImport: MyAccountImportComponent @@ -20,11 +19,11 @@ export class MyAccountImportExportComponent implements OnInit, CanComponentDeact ngOnInit () { this.authService.userInformationLoaded - .pipe(first()) - .subscribe(() => { - this.userService.getMyVideoQuotaUsed() - .subscribe(res => this.videoQuotaUsed = res.videoQuotaUsed) - }) + .pipe(first()) + .subscribe(() => { + this.userService.getMyVideoQuotaUsed() + .subscribe(res => this.videoQuotaUsed = res.videoQuotaUsed) + }) } canDeactivate () { diff --git a/client/src/app/+my-account/my-account-import-export/my-account-import.component.html b/client/src/app/+my-account/my-account-import-export/my-account-import.component.html index 4efae70e5..22bdf1107 100644 --- a/client/src/app/+my-account/my-account-import-export/my-account-import.component.html +++ b/client/src/app/+my-account/my-account-import-export/my-account-import.component.html @@ -7,8 +7,7 @@
@if (isImportEnabled()) { -

- You can import an archive created by another PeerTube website. +

You can import an archive created by another PeerTube website.

This is an import tool and not a migration tool. diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index 205e02eed..d8131a991 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core' -import { AuthUser, ScreenService, ServerService } from '@app/core' +import { AuthUser, ScreenService } from '@app/core' import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' @Component({ @@ -11,10 +11,7 @@ export class MyAccountComponent implements OnInit { menuEntries: TopMenuDropdownParam[] = [] user: AuthUser - constructor ( - private screenService: ScreenService, - private server: ServerService - ) { } + constructor (private screenService: ScreenService) { } get isBroadcastMessageDisplayed () { return this.screenService.isBroadcastMessageDisplayed diff --git a/packages/models/src/server/server-config.model.ts b/packages/models/src/server/server-config.model.ts index db1fbd072..cbd3ebddf 100644 --- a/packages/models/src/server/server-config.model.ts +++ b/packages/models/src/server/server-config.model.ts @@ -213,7 +213,7 @@ export interface ServerConfig { } users: { - enabled:boolean + enabled: boolean } } diff --git a/packages/server-commands/src/videos/videos-command.ts b/packages/server-commands/src/videos/videos-command.ts index c43eec253..6e541bc28 100644 --- a/packages/server-commands/src/videos/videos-command.ts +++ b/packages/server-commands/src/videos/videos-command.ts @@ -4,8 +4,7 @@ import validator from 'validator' import { getAllPrivacies, omit, pick, wait } from '@peertube/peertube-core-utils' import { HttpStatusCode, - HttpStatusCodeType, - ResultList, + HttpStatusCodeType, ResultList, UserVideoRateType, Video, VideoCreate, @@ -631,10 +630,12 @@ export class VideosCommand extends AbstractCommand { return super.sendResumableChunks<{ video: VideoCreateResult }>(options) } - async buildResumeVideoUpload (options: Parameters[0]) { + async buildResumeVideoUpload ( + options: Parameters[0] + ): Promise { const result = await super.buildResumeUpload<{ video: VideoCreateResult }>(options) - return result?.video || undefined + return result?.video || result as any } prepareVideoResumableUpload (options: Parameters[0]) { diff --git a/packages/tests/src/api/check-params/user-import.ts b/packages/tests/src/api/check-params/user-import.ts index fa47d6fd0..6c4312bb1 100644 --- a/packages/tests/src/api/check-params/user-import.ts +++ b/packages/tests/src/api/check-params/user-import.ts @@ -1,12 +1,12 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ +import { HttpStatusCode } from '@peertube/peertube-models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@peertube/peertube-server-commands' -import { HttpStatusCode } from '../../../../models/src/http/http-status-codes.js' import { expect } from 'chai' describe('Test user import API validators', function () { diff --git a/packages/tests/src/shared/videos.ts b/packages/tests/src/shared/videos.ts index 4d438d133..b7c81bec8 100644 --- a/packages/tests/src/shared/videos.ts +++ b/packages/tests/src/shared/videos.ts @@ -301,8 +301,8 @@ function checkUploadVideoParam (options: { : server.videos.buildResumeVideoUpload({ token, fixture: attributes.fixture, - attaches: this.buildUploadAttaches(attributes), - fields: this.buildUploadFields(attributes), + attaches: server.videos.buildUploadAttaches(attributes, false), + fields: server.videos.buildUploadFields(attributes), expectedStatus, completedExpectedStatus, path: '/api/v1/videos/upload-resumable' diff --git a/server/core/models/video/video-playlist-element.ts b/server/core/models/video/video-playlist-element.ts index 008f97a40..6190d0c18 100644 --- a/server/core/models/video/video-playlist-element.ts +++ b/server/core/models/video/video-playlist-element.ts @@ -271,7 +271,8 @@ export class VideoPlaylistElementModel extends Model