Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add manage video button in ownership change

Chocobozzz57fd39ef798e
diff --git a/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.html b/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.html
index b9c29ad3e6..8a6900aa86 100644
--- a/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.html
+++ b/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.html
@@ -31,6 +31,7 @@
<td>
<span class="pt-badge" [ngClass]="getStateClass(entry.state.id)">{{ entry.state.label }}</span>
</td>
+
</ng-template>
<ng-template #actionCell let-entry>
diff --git a/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.ts b/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.ts
index cdc79f1580..6e6e4e6fd6 100644
--- a/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.ts
+++ b/client/src/app/+my-library/my-ownership-changes/my-video-ownership-changes/my-video-ownership-changes.component.ts
@@ -1,11 +1,12 @@
import { CommonModule, NgClass } from '@angular/common'
import { Component, inject, viewChild } from '@angular/core'
import { AuthService, Notifier } from '@app/core'
+import { ChangeOwnershipService } from '@app/shared/shared-change-ownership/change-ownership.service'
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 { Video } from '@app/shared/shared-main/video/video.model'
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'
@@ -53,6 +54,16 @@ export class MyVideoOwnershipChangesComponent {
this.dataLoader = this._dataLoader.bind(this)
const { simpleActions, bulkActions } = buildDropdownSimpleAndBulkActions<ChangeOwnership>([
+ [
+ {
+ label: () => $localize`Manage video`,
+ linkBuilder: changeOwnership => [ Video.buildManageUrl(changeOwnership.video) ],
+ isDisplayed: changeOwnership =>
+ (this.isReceiver(changeOwnership) && changeOwnership.state.id === ChangeOwnershipState.ACCEPTED) ||
+ (this.isInitiator(changeOwnership) && changeOwnership.state.id !== ChangeOwnershipState.ACCEPTED),
+ enableBulk: false
+ }
+ ],
[
{
label: () => $localize`Accept`,
@@ -81,6 +92,10 @@ export class MyVideoOwnershipChangesComponent {
return changeOwnership.nextOwnerAccount.id === this.authService.getUser().account.id
}
+ isInitiator (changeOwnership: ChangeOwnership) {
+ return changeOwnership.initiatorAccount.id === this.authService.getUser().account.id
+ }
+
getStateClass (status: ChangeOwnershipStateType) {
switch (status) {
case ChangeOwnershipState.ACCEPTED:
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
index 6d09673060..498f595883 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
@@ -149,7 +149,7 @@ export class MyVideoImportsComponent implements OnInit {
}
getEditVideoUrl (video: { uuid: string }) {
- return Video.buildUpdateUrl(video)
+ return Video.buildManageUrl(video)
}
deleteImport (videoImport: VideoImport) {
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index c708a4b39a..7710c17b98 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -133,7 +133,7 @@ export class Video implements VideoServerModel {
return buildVideoWatchPath({ shortUUID: video.shortUUID || video.uuid })
}
- static buildUpdateUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) {
+ static buildManageUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) {
return '/videos/manage/' + (video.shortUUID || video.uuid)
}
diff --git a/server/core/models/video/video.ts b/server/core/models/video/video.ts
index e16557cceb..cb8310afd8 100644
--- a/server/core/models/video/video.ts
+++ b/server/core/models/video/video.ts
@@ -1555,7 +1555,8 @@ export class VideoModel extends SequelizeModel<VideoModel> {
nsfw: null,
isLocal: true,
displayOnlyForFollower: null,
- privacyOneOf: [ videoPrivacy ]
+ privacyOneOf: [ videoPrivacy ],
+ skipPrivateIncludeCheck: true
})
return total