Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ <h1>{{ videoChannel.displayName }}</h1>

<div class="actor-handle">
<span>&#64;{{ videoChannel.nameWithHost }}</span>
<my-global-icon *ngIf="videoChannel.isApproved" iconName="green-check" aria-hidden="true"></my-global-icon>

<my-copy-button
[value]="videoChannel.nameWithHostForced" i18n-notification notification="Handle copied"
Expand Down
1 change: 1 addition & 0 deletions client/src/app/+video-watch/video-watch.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ <h1 class="video-info-name">{{ video.name }}</h1>
<a [routerLink]="[ '/a', video.byAccount ]" i18n-title title="Account page">
<span i18n>By {{ video.byAccount }}</span>
</a>
<my-global-icon *ngIf="isChannelApproved()" iconName="green-check" aria-hidden="true"></my-global-icon>
</ng-container>

<ng-container *ngIf="isChannelDisplayNameGeneric()">
Expand Down
10 changes: 8 additions & 2 deletions client/src/app/+video-watch/video-watch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import { VideoDescriptionComponent } from './shared/metadata/video-description.c
import { VideoTranscriptionComponent } from './shared/player-widgets/video-transcription.component'
import { VideoWatchPlaylistComponent } from './shared/player-widgets/video-watch-playlist.component'
import { RecommendedVideosComponent } from './shared/recommendations/recommended-videos.component'
import { GlobalIconComponent } from "@app/shared/shared-icons/global-icon.component"

const debugLogger = debug('peertube:watch:VideoWatchComponent')

Expand Down Expand Up @@ -124,8 +125,9 @@ type URLOptions = {
PrivacyConcernsComponent,
PlayerStylesComponent,
VideoWatchPlaylistComponent,
VideoTranscriptionComponent
]
VideoTranscriptionComponent,
GlobalIconComponent
]
})
export class VideoWatchComponent implements OnInit, OnDestroy {
private route = inject(ActivatedRoute)
Expand Down Expand Up @@ -295,6 +297,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
return genericChannelDisplayName.includes(this.video.channel.displayName)
}

isChannelApproved () {
return this.video.channel.isApproved ?? false
}

displayOtherVideosAsRow () {
// Use the same value as in the SASS file
return this.screenService.getWindowInnerWidth() <= 1100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const icons = {
'language': require('../../../assets/images/misc/language.svg'),
'video-lang': require('../../../assets/images/misc/video-lang.svg'),
'support': require('../../../assets/images/misc/support.svg'),
'green-check': require('../../../assets/images/misc/green-check.svg'),
'peertube-x': require('../../../assets/images/misc/peertube-x.svg'),
'robot': require('../../../assets/images/misc/miscellaneous-services.svg'), // material ui
'playlist-add': require('../../../assets/images/misc/playlist-add.svg'), // material ui
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {

viewsPerDay?: ViewsPerDate[]
totalViews?: number
isApproved?: boolean

static GET_ACTOR_AVATAR_URL (
actor: {
Expand Down Expand Up @@ -85,6 +86,10 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
this.totalViews = hash.totalViews
}

if (hash.isApproved !== null && hash.isApproved !== undefined) {
this.isApproved = hash.isApproved
}

if (hash.ownerAccount) {
this.ownerAccount = hash.ownerAccount
this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ <h2 i18n>UPDATE CHANNEL</h2>
</div>
</div>

<div class="form-group">
<my-peertube-checkbox
inputName="isApproved"
formControlName="isApproved"
i18n-labelText
labelText="Is Channel Approved ?"
></my-peertube-checkbox>
</div>

<div class="form-group markdown-block">
<label i18n for="support">Support</label>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { MarkdownHintComponent } from '../shared-main/text/markdown-hint.compone
type Form = {
name: FormControl<string>
displayName: FormControl<string>
description: FormControl<string>
description: FormControl<string>,
isApproved: FormControl<boolean>,
support: FormControl<string>
playerTheme: FormControl<PlayerChannelSettings['theme']>
bulkVideosSupportUpdate: FormControl<boolean>
Expand All @@ -41,7 +42,8 @@ export type FormValidatedOutput = {
name: string
displayName: string
description: string
support: string
support: string,
isApproved: boolean,
bulkVideosSupportUpdate: boolean
}
}
Expand Down Expand Up @@ -96,6 +98,7 @@ export class VideoChannelEditComponent implements OnInit {
displayName: VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR,
description: VIDEO_CHANNEL_DESCRIPTION_VALIDATOR,
support: VIDEO_CHANNEL_SUPPORT_VALIDATOR,
isApproved: null,
bulkVideosSupportUpdate: null,
playerTheme: null
}
Expand All @@ -104,6 +107,7 @@ export class VideoChannelEditComponent implements OnInit {
displayName: this.channel().displayName,
description: this.channel().description,
support: this.channel().support,
isApproved: this.channel().isApproved,
playerTheme: this.rawPlayerSettings().theme
}

Expand Down Expand Up @@ -168,6 +172,7 @@ export class VideoChannelEditComponent implements OnInit {
displayName: body.displayName,
description: body.description || null,
support: body.support || null,
isApproved: body.isApproved || false,

bulkVideosSupportUpdate: this.mode() === 'update'
? body.bulkVideosSupportUpdate || false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class VideoChannelUpdateComponent implements OnInit, AfterViewInit, OnDes
displayName: output.channel.displayName,
description: output.channel.description,
support: output.channel.support,
isApproved: output.channel.isApproved,
bulkVideosSupportUpdate: output.channel.bulkVideosSupportUpdate
}

Expand Down
4 changes: 4 additions & 0 deletions client/src/assets/images/misc/green-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export interface VideoChannelUpdate {
displayName?: string
description?: string
support?: string
support?: string,
isApproved?: boolean

bulkVideosSupportUpdate?: boolean
}
1 change: 1 addition & 0 deletions packages/models/src/videos/channel/video-channel.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface VideoChannel extends Actor {
videosCount?: number
viewsPerDay?: ViewsPerDate[] // chronologically ordered
totalViews?: number
isApproved?: boolean

banners: ActorImage[]
}
Expand Down
2 changes: 1 addition & 1 deletion server/core/controllers/api/video-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response)
await sequelizeTypescript.transaction(async t => {
if (videoChannelInfoToUpdate.displayName !== undefined) videoChannelInstance.name = videoChannelInfoToUpdate.displayName
if (videoChannelInfoToUpdate.description !== undefined) videoChannelInstance.description = videoChannelInfoToUpdate.description

if (videoChannelInfoToUpdate.isApproved !== undefined) videoChannelInstance.isApproved = videoChannelInfoToUpdate.isApproved
if (videoChannelInfoToUpdate.support !== undefined) {
const oldSupportField = videoChannelInstance.support
videoChannelInstance.support = videoChannelInfoToUpdate.support
Expand Down
2 changes: 1 addition & 1 deletion server/core/initializers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { CONFIG, registerConfigChangedHandler } from './config.js'

// ---------------------------------------------------------------------------

export const LAST_MIGRATION_VERSION = 930
export const LAST_MIGRATION_VERSION = 935

// ---------------------------------------------------------------------------

Expand Down
26 changes: 26 additions & 0 deletions server/core/initializers/migrations/0935-channel-approval.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as Sequelize from 'sequelize'

async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
const { transaction } = utils

{
await utils.queryInterface.addColumn('videoChannel', 'isApproved', {
type: Sequelize.BOOLEAN,
defaultValue: false,
allowNull: false
}, { transaction })
}
}

function down (options) {
throw new Error('Not implemented.')
}

export {
down,
up
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class VideoTableAttributes {

if (this.mode === 'get') {
attributeKeys = attributeKeys.concat([
'isApproved',
'support',
'createdAt',
'updatedAt'
Expand Down
6 changes: 6 additions & 0 deletions server/core/models/video/video-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
declare support: string

@AllowNull(false)
@Default(false)
@Column
declare isApproved: boolean

@CreatedAt
declare createdAt: Date

Expand Down Expand Up @@ -836,6 +841,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
videosCount,
viewsPerDay,
totalViews,
isApproved: this.isApproved,

avatars: actor.avatars
}
Expand Down
2 changes: 1 addition & 1 deletion server/core/types/models/video/video-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export type MChannelAccountSummaryFormattable =

export type MChannelFormattable =
& FunctionProperties<MChannel>
& Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'>
& Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support' | 'isApproved'>
& Use<'Actor', MActorFormattable>
& PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>

Expand Down
2 changes: 2 additions & 0 deletions support/doc/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11114,6 +11114,8 @@ components:
description: Channel description
support:
description: How to support/fund the channel
isApproved:
description: Channel Approval

VideoChannelCreate:
allOf:
Expand Down