From 3afe0ec3b32d2bd9183541ecbf40278710f8707d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Sep 2022 10:33:26 +0200 Subject: [PATCH] Fix broken dates with localized pages --- .../shared-instance/instance-follow.service.ts | 12 +++--------- .../shared-main/users/user-notification.service.ts | 1 - .../shared/shared-main/video/video-import.service.ts | 1 - .../shared-main/video/video-ownership.service.ts | 7 ++----- .../shared/shared-moderation/blocklist.service.ts | 12 ++---------- .../shared/shared-moderation/video-block.service.ts | 7 ++----- 6 files changed, 9 insertions(+), 31 deletions(-) diff --git a/client/src/app/shared/shared-instance/instance-follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.ts index 5366fd068..7568fbbf4 100644 --- a/client/src/app/shared/shared-instance/instance-follow.service.ts +++ b/client/src/app/shared/shared-instance/instance-follow.service.ts @@ -1,6 +1,6 @@ import { SortMeta } from 'primeng/api' import { from, Observable } from 'rxjs' -import { catchError, concatMap, map, toArray } from 'rxjs/operators' +import { catchError, concatMap, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' @@ -40,10 +40,7 @@ export class InstanceFollowService { if (actorType) params = params.append('actorType', actorType) return this.authHttp.get>(InstanceFollowService.BASE_APPLICATION_URL + '/following', { params }) - .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } getFollowers (options: { @@ -66,10 +63,7 @@ export class InstanceFollowService { if (actorType) params = params.append('actorType', actorType) return this.authHttp.get>(InstanceFollowService.BASE_APPLICATION_URL + '/followers', { params }) - .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } follow (hostsOrHandles: string[]) { diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts index df886ed65..0b3dd9a53 100644 --- a/client/src/app/shared/shared-main/users/user-notification.service.ts +++ b/client/src/app/shared/shared-main/users/user-notification.service.ts @@ -40,7 +40,6 @@ export class UserNotificationService { return this.authHttp.get>(UserNotificationService.BASE_NOTIFICATIONS_URL, { params, context }) .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), map(res => this.restExtractor.applyToResultListData(res, this.formatNotification.bind(this))), catchError(err => this.restExtractor.handleError(err)) ) diff --git a/client/src/app/shared/shared-main/video/video-import.service.ts b/client/src/app/shared/shared-main/video/video-import.service.ts index f9720033a..607c08d71 100644 --- a/client/src/app/shared/shared-main/video/video-import.service.ts +++ b/client/src/app/shared/shared-main/video/video-import.service.ts @@ -64,7 +64,6 @@ export class VideoImportService { .get>(UserService.BASE_USERS_URL + '/me/videos/imports', { params }) .pipe( switchMap(res => this.extractVideoImports(res)), - map(res => this.restExtractor.convertResultListDateToHuman(res)), catchError(err => this.restExtractor.handleError(err)) ) } diff --git a/client/src/app/shared/shared-main/video/video-ownership.service.ts b/client/src/app/shared/shared-main/video/video-ownership.service.ts index bc0e1b1d1..1e8f7f68c 100644 --- a/client/src/app/shared/shared-main/video/video-ownership.service.ts +++ b/client/src/app/shared/shared-main/video/video-ownership.service.ts @@ -1,6 +1,6 @@ import { SortMeta } from 'primeng/api' import { Observable } from 'rxjs' -import { catchError, map } from 'rxjs/operators' +import { catchError } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' @@ -35,10 +35,7 @@ export class VideoOwnershipService { params = this.restService.addRestGetParams(params, pagination, sort) return this.authHttp.get>(url, { params }) - .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } acceptOwnership (id: number, input: VideoChangeOwnershipAccept) { diff --git a/client/src/app/shared/shared-moderation/blocklist.service.ts b/client/src/app/shared/shared-moderation/blocklist.service.ts index 1169bf757..0fb7536e5 100644 --- a/client/src/app/shared/shared-moderation/blocklist.service.ts +++ b/client/src/app/shared/shared-moderation/blocklist.service.ts @@ -53,7 +53,6 @@ export class BlocklistService { return this.authHttp.get>(BlocklistService.BASE_USER_BLOCKLIST_URL + '/accounts', { params }) .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), map(res => this.restExtractor.applyToResultListData(res, this.formatAccountBlock.bind(this))), catchError(err => this.restExtractor.handleError(err)) ) @@ -84,10 +83,7 @@ export class BlocklistService { if (search) params = params.append('search', search) return this.authHttp.get>(BlocklistService.BASE_USER_BLOCKLIST_URL + '/servers', { params }) - .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } blockServerByUser (host: string) { @@ -116,7 +112,6 @@ export class BlocklistService { return this.authHttp.get>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { params }) .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), map(res => this.restExtractor.applyToResultListData(res, this.formatAccountBlock.bind(this))), catchError(err => this.restExtractor.handleError(err)) ) @@ -151,10 +146,7 @@ export class BlocklistService { if (search) params = params.append('search', search) return this.authHttp.get>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/servers', { params }) - .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } blockServerByInstance (host: string) { diff --git a/client/src/app/shared/shared-moderation/video-block.service.ts b/client/src/app/shared/shared-moderation/video-block.service.ts index 6272b672f..ab352a2d6 100644 --- a/client/src/app/shared/shared-moderation/video-block.service.ts +++ b/client/src/app/shared/shared-moderation/video-block.service.ts @@ -1,6 +1,6 @@ import { SortMeta } from 'primeng/api' import { from as observableFrom, Observable } from 'rxjs' -import { catchError, concatMap, map, toArray } from 'rxjs/operators' +import { catchError, concatMap, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' @@ -47,10 +47,7 @@ export class VideoBlockService { if (type) params = params.append('type', type.toString()) return this.authHttp.get>(VideoBlockService.BASE_VIDEOS_URL + 'blacklist', { params }) - .pipe( - map(res => this.restExtractor.convertResultListDateToHuman(res)), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } unblockVideo (videoIdArgs: number | number[]) {