X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Baccounts%2Faccount-video-channels%2Faccount-video-channels.component.ts;h=631444398cc73e889fe1fc0a3966bad150dfb356;hb=cb0eda5602a21d1626a7face32de6153ed07b5f9;hp=0628c7a9633d0d9137a4aa43f80f5f02829ed812;hpb=dc48fdbe68e9dd3a3a6028181e61d8595d98e654;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts index 0628c7a96..631444398 100644 --- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts +++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts @@ -1,10 +1,11 @@ import { from, Subject, Subscription } from 'rxjs' import { concatMap, map, switchMap, tap } from 'rxjs/operators' import { Component, OnDestroy, OnInit } from '@angular/core' -import { ComponentPagination, hasMoreItems, MarkdownService, ScreenService, User, UserService } from '@app/core' +import { ComponentPagination, hasMoreItems, MarkdownService, User, UserService } from '@app/core' import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' -import { NSFWPolicyType, VideoSortField } from '@shared/models' import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' +import { NSFWPolicyType, VideoSortField } from '@shared/models' +import { SimpleMemoize } from '@app/helpers' @Component({ selector: 'my-account-video-channels', @@ -62,6 +63,7 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy { this.accountSub = this.accountService.accountLoaded .subscribe(account => { this.account = account + this.videoChannels = [] this.loadMoreChannels() }) @@ -79,9 +81,17 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy { } loadMoreChannels () { - this.videoChannelService.listAccountVideoChannels(this.account, this.channelPagination) + const options = { + account: this.account, + componentPagination: this.channelPagination, + sort: '-updatedAt' + } + + this.videoChannelService.listAccountVideoChannels(options) .pipe( - tap(res => this.channelPagination.totalItems = res.total), + tap(res => { + this.channelPagination.totalItems = res.total + }), switchMap(res => from(res.data)), concatMap(videoChannel => { const options = { @@ -96,7 +106,11 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy { }) ) .subscribe(async ({ videoChannel, videos, total }) => { - this.channelsDescriptionHTML[videoChannel.id] = await this.markdown.textMarkdownToHTML(videoChannel.description) + this.channelsDescriptionHTML[videoChannel.id] = await this.markdown.textMarkdownToHTML({ + markdown: videoChannel.description, + withEmoji: true, + withHtml: true + }) this.videoChannels.push(videoChannel) @@ -107,14 +121,14 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy { } getVideosOf (videoChannel: VideoChannel) { - const obj = this.videos[ videoChannel.id ] + const obj = this.videos[videoChannel.id] if (!obj) return [] return obj.videos } getTotalVideosOf (videoChannel: VideoChannel) { - const obj = this.videos[ videoChannel.id ] + const obj = this.videos[videoChannel.id] if (!obj) return undefined return obj.total @@ -132,7 +146,8 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy { this.loadMoreChannels() } + @SimpleMemoize() getVideoChannelLink (videoChannel: VideoChannel) { - return [ '/video-channels', videoChannel.nameWithHost ] + return [ '/c', videoChannel.nameWithHost ] } }