ActivityPub-federated video streaming platform using P2P directly in your web browser
Remove channels ownership changes list
Chocobozzz4c3be4f11630
diff --git a/client/src/app/+my-library/my-ownership-changes/my-channel-ownership-changes/my-channel-ownership-changes.component.html b/client/src/app/+my-library/my-ownership-changes/my-channel-ownership-changes/my-channel-ownership-changes.component.htmldeleted file mode 100644index 8d5c7fa939..0000000000--- a/client/src/app/+my-library/my-ownership-changes/my-channel-ownership-changes/my-channel-ownership-changes.component.html+++ /dev/null@@ -1,46 +0,0 @@-<my-table- #table- key="MyChannelOwnershipChangesComponent"- [defaultColumns]="columns"- i18n-paginatorText- paginatorText="entries per page"- [dataLoader]="dataLoader"- columnConfig="false"- [bulkActions]="bulkActions"->- <ng-template #totalTitle let-totalRecords>- <ng-container i18n>{ totalRecords, plural, =0 {No channel ownership change} =1 {1 channel ownership change} other {{{ totalRecords | myNumberFormatter }} channel ownership changes}}</ng-container>- </ng-template>-- <ng-template #tableCells let-entry>- <td>- <my-actor-cell [actor]="entry.videoChannel" actorType="channel" [displayAvatar]="true" [displayUsername]="true" target="_blank"></my-actor-cell>- </td>-- <td>- @if (isReceiver(entry)) {- <span class="pt-badge badge-primary">TO YOU</span>- } @else {- <my-actor-cell [actor]="entry.nextOwnerAccount" actorType="account" [displayAvatar]="true" [displayUsername]="true" target="_blank"></my-actor-cell>- }-- </td>-- <td>{{ entry.createdAt | ptDate: 'short' }}</td>-- <td>- <span class="pt-badge" [ngClass]="getStateClass(entry.state.id)">{{ entry.state.label }}</span>- </td>- </ng-template>-- <ng-template #actionCell let-entry>- <my-action-dropdown- placement="bottom-right top-right left auto" container="body"- i18n-label label="Actions" [actions]="actions" [entry]="entry"- ></my-action-dropdown>- </ng-template>-- <ng-template #noResults>- <ng-container i18n>No ownership change request found.</ng-container>- </ng-template>-</my-table>diff --git a/client/src/app/+my-library/my-ownership-changes/my-channel-ownership-changes/my-channel-ownership-changes.component.ts b/client/src/app/+my-library/my-ownership-changes/my-channel-ownership-changes/my-channel-ownership-changes.component.tsdeleted file mode 100644index 19cb1d3501..0000000000--- a/client/src/app/+my-library/my-ownership-changes/my-channel-ownership-changes/my-channel-ownership-changes.component.ts+++ /dev/null@@ -1,122 +0,0 @@-import { CommonModule, NgClass } from '@angular/common'-import { Component, inject, viewChild } from '@angular/core'-import { AuthService, Notifier } from '@app/core'-import { Account } from '@app/shared/shared-main/account/account.model'-import { buildDropdownSimpleAndBulkActions } from '@app/shared/shared-main/buttons/action-dropdown-helpers'-import { ActionDropdownComponent, DropdownAction } from '@app/shared/shared-main/buttons/action-dropdown.component'-import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'-import { ChangeOwnershipService } from '@app/shared/shared-change-ownership/change-ownership.service'-import { ActorCellComponent } from '@app/shared/shared-tables/actor-cell.component'-import { DataLoaderOptionsBase, TableColumnInfo, TableComponent } from '@app/shared/shared-tables/table.component'-import { ChangeOwnership, ChangeOwnershipState, ChangeOwnershipStateType } from '@peertube/peertube-models'-import { map } from 'rxjs'-import { NumberFormatterPipe } from '../../../shared/shared-main/common/number-formatter.pipe'--@Component({- selector: 'my-channel-ownership-changes',- templateUrl: './my-channel-ownership-changes.component.html',- imports: [- CommonModule,- NgClass,- PTDatePipe,- NumberFormatterPipe,- TableComponent,- ActionDropdownComponent,- ActorCellComponent- ]-})-export class MyChannelOwnershipChangesComponent {- private notifier = inject(Notifier)- private changeOwnershipService = inject(ChangeOwnershipService)- private authService = inject(AuthService)-- readonly table = viewChild<TableComponent<ChangeOwnership>>('table')-- actions: DropdownAction<ChangeOwnership>[][] = []- bulkActions: DropdownAction<ChangeOwnership[]>[][] = []-- columns: TableColumnInfo<string>[] = [- { id: 'channel', label: $localize`Channel`, sortable: false },- { id: 'targetAccount', label: $localize`Target account`, sortable: false },- { id: 'createdAt', label: $localize`Created`, sortable: true },- { id: 'status', label: $localize`Status`, sortable: false }- ]-- dataLoader: typeof this._dataLoader-- constructor () {- this.dataLoader = this._dataLoader.bind(this)-- const { simpleActions, bulkActions } = buildDropdownSimpleAndBulkActions<ChangeOwnership>([- [- {- label: $localize`Accept`,- handler: changeOwnership => this.accept(changeOwnership),- isDisplayed: changeOwnership => this.canAcceptOrReject(changeOwnership),- enableBulk: true- },- {- label: $localize`Reject`,- handler: changeOwnership => this.reject(changeOwnership),- isDisplayed: changeOwnership => this.canAcceptOrReject(changeOwnership),- enableBulk: true- }- ]- ])-- this.actions = simpleActions- this.bulkActions = bulkActions- }-- private canAcceptOrReject (changeOwnership: ChangeOwnership) {- return this.isReceiver(changeOwnership) && changeOwnership.state.id === ChangeOwnershipState.PENDING- }-- isReceiver (changeOwnership: ChangeOwnership) {- return changeOwnership.nextOwnerAccount.id === this.authService.getUser().account.id- }-- getStateClass (status: ChangeOwnershipStateType) {- switch (status) {- case ChangeOwnershipState.ACCEPTED:- return 'badge-green'-- case ChangeOwnershipState.REJECTED:- return 'badge-red'-- default:- return 'badge-yellow'- }- }-- accept (entries: ChangeOwnership[]) {- this.changeOwnershipService.acceptChannel(entries.map(entry => entry.id))- .subscribe({- next: () => this.table().loadData(),- error: err => this.notifier.handleError(err)- })- }-- reject (entries: ChangeOwnership[]) {- this.changeOwnershipService.rejectChannel(entries.map(entry => entry.id))- .subscribe({- next: () => this.table().loadData(),- error: err => this.notifier.handleError(err)- })- }-- private _dataLoader (options: DataLoaderOptionsBase) {- return this.changeOwnershipService.listOfChannels(options.pagination, options.sort)- .pipe(- map(resultList => ({- data: resultList.data.map(change => ({- ...change,-- initiatorAccount: new Account(change.initiatorAccount),- nextOwnerAccount: new Account(change.nextOwnerAccount)- })),- total: resultList.total- }))- )- }-}diff --git a/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.html b/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.htmlindex ab4c547be8..8faed780a9 100644--- a/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.html+++ b/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.html@@ -1,2 +1 @@<my-video-ownership-changes></my-video-ownership-changes>-<my-channel-ownership-changes></my-channel-ownership-changes>diff --git a/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.ts b/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.tsindex 43ab150702..8f695139f2 100644--- a/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.ts+++ b/client/src/app/+my-library/my-ownership-changes/my-ownership-changes.component.ts@@ -1,10 +1,9 @@import { Component } from '@angular/core'-import { MyChannelOwnershipChangesComponent } from './my-channel-ownership-changes/my-channel-ownership-changes.component'import { MyVideoOwnershipChangesComponent } from './my-video-ownership-changes/my-video-ownership-changes.component'@Component({templateUrl: './my-ownership-changes.component.html',- imports: [ MyVideoOwnershipChangesComponent, MyChannelOwnershipChangesComponent ]+ imports: [ MyVideoOwnershipChangesComponent ]})export class MyOwnershipChangesComponent {}diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.tsindex 5fb9f1650c..2d6c7cb524 100644--- a/client/src/app/shared/shared-main/users/user-notification.model.ts+++ b/client/src/app/shared/shared-main/users/user-notification.model.ts@@ -1,6 +1,7 @@import { AuthUser } from '@app/core'import { Actor } from '@app/shared/shared-main/account/actor.model'import {+ ChangeOwnershipState,UserNotification as UserNotificationServer,UserNotificationType,UserRight,@@ -161,13 +162,15 @@ export class UserNotification {case UserNotificationType.VIDEO_OWNERSHIP_CHANGED_REQUEST:case UserNotificationType.VIDEO_OWNERSHIP_CHANGED_ACCEPTED:case UserNotificationType.VIDEO_OWNERSHIP_CHANGED_REJECTED:- case UserNotificationType.CHANNEL_OWNERSHIP_CHANGED_REQUEST:- case UserNotificationType.CHANNEL_OWNERSHIP_CHANGED_ACCEPTED:- case UserNotificationType.CHANNEL_OWNERSHIP_CHANGED_REJECTED:this.url = '/my-library/ownership'break++ case UserNotificationType.CHANNEL_OWNERSHIP_CHANGED_REQUEST:+ if (payload.changeOwnership.state.id === ChangeOwnershipState.ACCEPTED) {+ this.url = this.buildChannelUrl(payload.changeOwnership.channel)+ } // Else, no URL: we have buttons instead to accept/decline the request}- } catch (err) {+ } catch (err: any) {this.payload.type = nulllogger.error(err)}diff --git a/client/src/app/shared/shared-notifications/user-notification-content.component.html b/client/src/app/shared/shared-notifications/user-notification-content.component.htmlindex e0a6bc4f41..92e4824f55 100644--- a/client/src/app/shared/shared-notifications/user-notification-content.component.html+++ b/client/src/app/shared/shared-notifications/user-notification-content.component.html@@ -298,7 +298,7 @@<my-global-icon iconName="user-add"></my-global-icon><div class="message" i18n>- <strong>{{ n.payload.changeOwnership.initiatorAccount.displayName }}</strong> requested to transfer ownership of channel <strong>{{ n.payload.changeOwnership.videoChannel.displayName }}</strong> to you+ <strong>{{ n.payload.changeOwnership.initiatorAccount.displayName }}</strong> requested to transfer ownership of channel <strong>{{ n.payload.changeOwnership.channel.displayName }}</strong> to you</div>@if (isOwnershipChangeRejected(n)) {@@ -325,7 +325,7 @@<my-global-icon iconName="tick"></my-global-icon><div class="message" i18n>- <strong>{{ n.payload.changeOwnership.nextOwnerAccount.displayName }}</strong> accepted the ownership change request for channel <strong>{{ n.payload.changeOwnership.videoChannel.displayName }}</strong>+ <strong>{{ n.payload.changeOwnership.nextOwnerAccount.displayName }}</strong> accepted the ownership change request for channel <strong>{{ n.payload.changeOwnership.channel.displayName }}</strong></div>}@@ -333,7 +333,7 @@<my-global-icon iconName="cross"></my-global-icon><div class="message" i18n>- <strong>{{ n.payload.changeOwnership.nextOwnerAccount.displayName }}</strong> rejected the ownership change request for channel <strong>{{ n.payload.changeOwnership.videoChannel.displayName }}</strong>+ <strong>{{ n.payload.changeOwnership.nextOwnerAccount.displayName }}</strong> rejected the ownership change request for channel <strong>{{ n.payload.changeOwnership.channel.displayName }}</strong></div>}diff --git a/client/src/app/shared/shared-notifications/user-notification-content.component.ts b/client/src/app/shared/shared-notifications/user-notification-content.component.tsindex be0cd00985..7a2c78c732 100644--- a/client/src/app/shared/shared-notifications/user-notification-content.component.ts+++ b/client/src/app/shared/shared-notifications/user-notification-content.component.ts@@ -143,9 +143,9 @@ export class UserNotificationContentComponent {this.authService.refreshUserInformation()this.n.payload.changeOwnership.state.id = ChangeOwnershipState.ACCEPTED- this.n.url = this.n.buildChannelUrl(changeOwnership.videoChannel)+ this.n.url = this.n.buildChannelUrl(changeOwnership.channel)this.router.navigate(this.n.url)- this.notifier.success($localize`You are now the owner of the channel ${changeOwnership.videoChannel.name}`)+ this.notifier.success($localize`You are now the owner of the channel ${changeOwnership.channel.name}`)},error: err => this.notifier.handleError(err)diff --git a/packages/models/src/users/user-notification.model.ts b/packages/models/src/users/user-notification.model.tsindex 02b9c0cc0d..eb841d8cfd 100644--- a/packages/models/src/users/user-notification.model.ts+++ b/packages/models/src/users/user-notification.model.ts@@ -187,7 +187,7 @@ export interface UserNotification {nextOwnerAccount: ActorInfovideo: VideoInfo- videoChannel: ActorInfo+ channel: ActorInfo}createdAt: stringdiff --git a/server/core/models/user/user-notification.ts b/server/core/models/user/user-notification.tsindex 28be620efd..d0c365d1a5 100644--- a/server/core/models/user/user-notification.ts+++ b/server/core/models/user/user-notification.ts@@ -580,7 +580,7 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>? this.formatVideo(this.ChangeOwnership.Video): undefined,- videoChannel: this.ChangeOwnership.VideoChannel+ channel: this.ChangeOwnership.VideoChannel? this.formatActor(this.ChangeOwnership.VideoChannel): undefined}