From 98ab5dc81048d47d08a231f17698128f959e59b2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Aug 2021 16:14:11 +0200 Subject: Remove useless async --- .../+admin/config/edit-custom-config/edit-custom-config.component.ts | 2 +- .../src/app/+admin/follows/following-list/follow-modal.component.ts | 2 +- .../moderation/video-comment-list/video-comment-list.component.ts | 2 +- client/src/app/+admin/users/user-list/user-list.component.ts | 2 +- client/src/app/+home/home.component.ts | 2 +- client/src/app/+search/search.component.ts | 2 +- .../+videos/+video-edit/shared/video-caption-add-modal.component.ts | 2 +- client/src/app/+videos/+video-edit/shared/video-edit.component.ts | 2 +- .../+video-watch/shared/information/privacy-concerns.component.ts | 3 ++- client/src/app/+videos/+video-watch/video-watch.component.ts | 4 ++-- client/src/app/app.component.ts | 4 ++-- client/src/app/core/notification/peertube-socket.service.ts | 2 +- .../shared/shared-abuse-list/moderation-comment-modal.component.ts | 2 +- client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | 3 ++- client/src/app/shared/shared-moderation/user-ban-modal.component.ts | 2 +- client/src/assets/player/stats/stats-card.ts | 4 ++-- client/src/assets/player/webtorrent/peertube-chunk-store.ts | 2 +- client/src/standalone/videos/embed.ts | 4 ++-- client/src/standalone/videos/test-embed.ts | 2 +- 19 files changed, 25 insertions(+), 23 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index be1a99289..f13fe4bf9 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -260,7 +260,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { this.loadCategoriesAndLanguages() } - async formValidated () { + formValidated () { const value: ComponentCustomConfig = this.form.getRawValue() forkJoin([ diff --git a/client/src/app/+admin/follows/following-list/follow-modal.component.ts b/client/src/app/+admin/follows/following-list/follow-modal.component.ts index c55fc8d81..c40b36e10 100644 --- a/client/src/app/+admin/follows/following-list/follow-modal.component.ts +++ b/client/src/app/+admin/follows/following-list/follow-modal.component.ts @@ -54,7 +54,7 @@ export class FollowModalComponent extends FormReactive implements OnInit { return window.location.protocol === 'https:' } - private async addFollowing () { + private addFollowing () { const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles']) this.followService.follow(hostsOrHandles) diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts index 512ceffd9..c09ce7293 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts @@ -134,7 +134,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit { }) } - private async removeComments (comments: VideoCommentAdmin[]) { + private removeComments (comments: VideoCommentAdmin[]) { const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id })) this.videoCommentService.deleteVideoComments(commentArgs) diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 39caf5ed5..1030759df 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -206,7 +206,7 @@ export class UserListComponent extends RestTable implements OnInit { }) } - async setEmailsAsVerified (users: User[]) { + setEmailsAsVerified (users: User[]) { this.userService.updateUsers(users, { emailVerified: true }) .subscribe({ next: () => { diff --git a/client/src/app/+home/home.component.ts b/client/src/app/+home/home.component.ts index 6e0c96760..f966a2b02 100644 --- a/client/src/app/+home/home.component.ts +++ b/client/src/app/+home/home.component.ts @@ -15,7 +15,7 @@ export class HomeComponent implements OnInit { private customPageService: CustomPageService ) { } - async ngOnInit () { + ngOnInit () { this.customPageService.getInstanceHomepage() .subscribe(({ content }) => this.homepageContent = content) } diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index 81d1006f8..fcf6ebbec 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts @@ -75,7 +75,7 @@ export class SearchComponent implements OnInit, OnDestroy { this.subActivatedRoute = this.route.queryParams .subscribe({ - next: async queryParams => { + next: queryParams => { const querySearch = queryParams['search'] const searchTarget = queryParams['searchTarget'] diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts index 98d66ff00..5c4152884 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts @@ -71,7 +71,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni return languageId && this.existingCaptions.includes(languageId) } - async addCaption () { + addCaption () { const languageId = this.form.value['language'] const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 366c93a79..bf7fdeeed 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts @@ -231,7 +231,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { this.sortVideoCaptions() } - async deleteCaption (caption: VideoCaptionEdit) { + deleteCaption (caption: VideoCaptionEdit) { // Caption recovers his former state if (caption.action && this.initialVideoCaptions.includes(caption.language.id)) { caption.action = undefined diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts index ef5c8ed87..b1e8bf989 100644 --- a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts @@ -21,8 +21,9 @@ export class PrivacyConcernsComponent implements OnInit { private serverService: ServerService ) { } - async ngOnInit () { + ngOnInit () { this.serverConfig = this.serverService.getHTMLConfig() + if ( isWebRTCDisabled() || this.serverConfig.tracker.enabled === false || diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 2007bdecb..acfd46a41 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -113,7 +113,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { return this.userService.getAnonymousUser() } - async ngOnInit () { + ngOnInit () { this.serverConfig = this.serverService.getHTMLConfig() PeertubePlayerManager.initState() @@ -640,7 +640,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } if (oldVideo && oldVideo.id !== newVideo.id) { - await this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id) + this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id) } if (!newVideo.isLive) return diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 4d5a9f75f..ae6046cc1 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -220,7 +220,7 @@ export class AppComponent implements OnInit, AfterViewInit { } } - private async openModalsIfNeeded () { + private openModalsIfNeeded () { this.authService.userInformationLoaded .pipe( map(() => this.authService.getUser()), @@ -232,7 +232,7 @@ export class AppComponent implements OnInit, AfterViewInit { ).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user)) } - private async _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) { + private _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) { if (user.noWelcomeModal !== true) return this.welcomeModal.show() if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) return diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.ts index eab1c63f2..50d5df68f 100644 --- a/client/src/app/core/notification/peertube-socket.service.ts +++ b/client/src/app/core/notification/peertube-socket.service.ts @@ -38,7 +38,7 @@ export class PeerTubeSocket { this.liveVideosSocket.emit('subscribe', { videoId }) } - async unsubscribeLiveVideos (videoId: number) { + unsubscribeLiveVideos (videoId: number) { if (!this.liveVideosSocket) return this.liveVideosSocket.emit('unsubscribe', { videoId }) diff --git a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts index ccb0c5262..2600da8da 100644 --- a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts @@ -49,7 +49,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI this.form.reset() } - async banUser () { + banUser () { const moderationComment: string = this.form.value['moderationComment'] this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts index e7e34ce1e..a8cc9b593 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts @@ -84,8 +84,9 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { this.modalService.open(this.modal, { centered: true, - beforeDismiss: async () => { + beforeDismiss: () => { this.onModalDismiss() + return true } }) diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts index 0a2d5e93a..a03bd7286 100644 --- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts @@ -43,7 +43,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit { this.openedModal.close() } - async banUser () { + banUser () { const reason = this.form.value['reason'] || undefined this.userService.banUsers(this.usersToBan, reason) diff --git a/client/src/assets/player/stats/stats-card.ts b/client/src/assets/player/stats/stats-card.ts index a32f6fb97..45fd30d55 100644 --- a/client/src/assets/player/stats/stats-card.ts +++ b/client/src/assets/player/stats/stats-card.ts @@ -86,7 +86,7 @@ class StatsCard extends Component { this.updateInterval = setInterval(async () => { try { const options = this.mode === 'p2p-media-loader' - ? await this.buildHLSOptions() + ? this.buildHLSOptions() : await this.buildWebTorrentOptions() // Default this.list.innerHTML = this.getListTemplate(options) @@ -102,7 +102,7 @@ class StatsCard extends Component { this.container.style.display = 'none' } - private async buildHLSOptions () { + private buildHLSOptions () { const p2pMediaLoader = this.player_.p2pMediaLoader() const level = p2pMediaLoader.getCurrentLevel() diff --git a/client/src/assets/player/webtorrent/peertube-chunk-store.ts b/client/src/assets/player/webtorrent/peertube-chunk-store.ts index 93ca8e1d8..81378c277 100644 --- a/client/src/assets/player/webtorrent/peertube-chunk-store.ts +++ b/client/src/assets/player/webtorrent/peertube-chunk-store.ts @@ -184,7 +184,7 @@ export class PeertubeChunkStore extends EventEmitter { private runCleaner () { this.checkExpiration() - this.cleanerInterval = setInterval(async () => { + this.cleanerInterval = setInterval(() => { this.checkExpiration() }, PeertubeChunkStore.CLEANER_INTERVAL_MS) } diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index f35f4a23a..36480922e 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts @@ -589,7 +589,7 @@ export class PeerTubeEmbed { this.buildCSS() - await this.buildDock(videoInfo) + this.buildDock(videoInfo) this.initializeApi() @@ -665,7 +665,7 @@ export class PeerTubeEmbed { } } - private async buildDock (videoInfo: VideoDetails) { + private buildDock (videoInfo: VideoDetails) { if (!this.controls) return // On webtorrent fallback, player may have been disposed diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts index a051f1f89..301c95d7b 100644 --- a/client/src/standalone/videos/test-embed.ts +++ b/client/src/standalone/videos/test-embed.ts @@ -47,7 +47,7 @@ window.addEventListener('load', async () => { let playbackRates: number[] = [] let currentRate = await player.getPlaybackRate() - const updateRates = async () => { + const updateRates = () => { const rateListEl = document.querySelector('#rate-list') rateListEl.innerHTML = '' -- cgit v1.2.3