X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bmy-account%2Fmy-account-ownership%2Fmy-account-ownership.component.ts;h=98360dfb35608e215c481c67806118c9e97007d9;hb=57e56eb2941cce88a2a9b538b3e6a761ece6a317;hp=cd8065800616e5f5ba4f9175cb72265be2694dc6;hpb=c2777c1dfe688c8fab1ef2fed50e360100fa9198;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts index cd8065800..98360dfb3 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts @@ -1,20 +1,19 @@ -import { Component, OnInit, ViewChild } from '@angular/core' -import { Notifier } from '@app/core' -import { RestPagination, RestTable } from '@app/shared' import { SortMeta } from 'primeng/api' -import { VideoChangeOwnership } from '../../../../../shared' -import { VideoOwnershipService } from '@app/shared/video-ownership' -import { Account } from '@app/shared/account/account.model' +import { Component, OnInit, ViewChild } from '@angular/core' +import { Notifier, RestPagination, RestTable } from '@app/core' +import { VideoOwnershipService, Actor, Video, Account } from '@app/shared/shared-main' +import { VideoChangeOwnership } from '@shared/models' import { MyAccountAcceptOwnershipComponent } from './my-account-accept-ownership/my-account-accept-ownership.component' +import { getAbsoluteAPIUrl } from '@app/helpers' @Component({ selector: 'my-account-ownership', - templateUrl: './my-account-ownership.component.html' + templateUrl: './my-account-ownership.component.html', + styleUrls: [ './my-account-ownership.component.scss' ] }) export class MyAccountOwnershipComponent extends RestTable implements OnInit { videoChangeOwnerships: VideoChangeOwnership[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } @@ -31,8 +30,12 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit { this.initialize() } - createByString (account: Account) { - return Account.CREATE_BY_STRING(account.name, account.host) + getIdentifier () { + return 'MyAccountOwnershipComponent' + } + + switchToDefaultAvatar ($event: Event) { + ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() } openAcceptModal (videoChangeOwnership: VideoChangeOwnership) { @@ -55,7 +58,11 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit { return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort) .subscribe( resultList => { - this.videoChangeOwnerships = resultList.data + this.videoChangeOwnerships = resultList.data.map(change => ({ + ...change, + initiatorAccount: new Account(change.initiatorAccount), + nextOwnerAccount: new Account(change.nextOwnerAccount) + })) this.totalRecords = resultList.total },