]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
Fix HTML in account/channel description
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-video-channels / account-video-channels.component.ts
index 0628c7a9633d0d9137a4aa43f80f5f02829ed812..59814a93d4aca2160486188ea26a96b6d2e97bcb 100644 (file)
@@ -1,10 +1,10 @@
 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'
 
 @Component({
   selector: 'my-account-video-channels',
@@ -62,6 +62,7 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
     this.accountSub = this.accountService.accountLoaded
         .subscribe(account => {
           this.account = account
+          this.videoChannels = []
 
           this.loadMoreChannels()
         })
@@ -79,9 +80,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 +105,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 +120,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
@@ -133,6 +146,6 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
   }
 
   getVideoChannelLink (videoChannel: VideoChannel) {
-    return [ '/video-channels', videoChannel.nameWithHost ]
+    return [ '/c', videoChannel.nameWithHost ]
   }
 }