ActivityPub-federated video streaming platform using P2P directly in your web browser
Add ability to reset originallyPublishedAt
Chocobozzz7ace48819edc
diff --git a/client/src/app/+search/search-filters.component.html b/client/src/app/+search/search-filters.component.htmlindex ed0632a4dc..5b9237379c 100644--- a/client/src/app/+search/search-filters.component.html+++ b/client/src/app/+search/search-filters.component.html@@ -226,7 +226,7 @@</div><div class="submit-button">- <button i18n class="reset-button" (click)="reset()" *ngIf="advancedSearch.size()">+ <button i18n class="reset-button me-3" (click)="reset()" *ngIf="advancedSearch.size()">Reset</button>diff --git a/client/src/app/+search/search-filters.component.scss b/client/src/app/+search/search-filters.component.scssindex c55e59310c..fd997d33b9 100644--- a/client/src/app/+search/search-filters.component.scss+++ b/client/src/app/+search/search-filters.component.scss@@ -34,27 +34,3 @@ input[type=submit] {.submit-button {text-align: end;}--.reset-button {- @include peertube-button;- @include margin-right(1rem);-- font-weight: $font-semibold;- display: inline-block;- padding: 0 10px;- white-space: nowrap;- background: transparent;-}--.reset-button-small {- font-size: 80%;- height: unset;- line-height: unset;- margin: unset;- margin-bottom: 0.5rem;-}--.label-container {- display: flex;- white-space: nowrap;-}diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.htmlindex ea99096125..f3c1f1634a 100644--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html@@ -365,14 +365,18 @@</div><div class="form-group originally-published-at">- <label i18n for="originallyPublishedAt">Original publication date</label>- <my-help>- <ng-template ptTemplate="preHtml">- <ng-container i18n>- This is the date when the content was originally published (e.g. the release date for a film)- </ng-container>- </ng-template>- </my-help>+ <div class="label-container">+ <label i18n for="originallyPublishedAt">Original publication date</label>++ <button i18n class="reset-button reset-button-small" (click)="resetField('originallyPublishedAt')" *ngIf="hasPublicationDate()">+ Reset+ </button>+ </div>++ <div class="form-group-description" i18n>+ This is the date when the content was originally published (e.g. the release date for a film)+ </div>+<p-calendarid="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat" [firstDayOfWeek]="0"[showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.tsindex b0c1352f33..898d3b0a61 100644--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts@@ -264,6 +264,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {if (this.schedulerInterval) clearInterval(this.schedulerInterval)}+ // ---------------------------------------------------------------------------+getExistingCaptions () {return this.videoCaptions.filter(c => c.action !== 'REMOVE')@@ -312,6 +314,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {modalRef.componentInstance.captionEdited.subscribe(this.onCaptionEdited.bind(this))}+ // ---------------------------------------------------------------------------+isSaveReplayAllowed () {return this.serverConfig.live.allowReplay}@@ -328,6 +332,18 @@ export class VideoEditComponent implements OnInit, OnDestroy {return this.serverConfig.live.latencySetting.enabled}+ hasPublicationDate () {+ return !!this.form.value['originallyPublishedAt']+ }++ // ---------------------------------------------------------------------------++ resetField (name: string) {+ this.form.patchValue({ [name]: null })+ }++ // ---------------------------------------------------------------------------+isPluginFieldHidden (pluginField: PluginField) {if (typeof pluginField.commonOptions.hidden !== 'function') return falsediff --git a/client/src/app/shared/shared-forms/reactive-file.component.html b/client/src/app/shared/shared-forms/reactive-file.component.htmlindex 8e38697e44..33bb88f1f2 100644--- a/client/src/app/shared/shared-forms/reactive-file.component.html+++ b/client/src/app/shared/shared-forms/reactive-file.component.html@@ -13,7 +13,7 @@<div class="filename" *ngIf="displayFilename === true && filename">{{ filename }}</div>- <button *ngIf="displayReset && filename" i18n class="reset-button" (click)="reset()">+ <button *ngIf="displayReset && filename" i18n class="reset-button reset-button-small ms-2" (click)="reset()">Reset</button></div>diff --git a/client/src/app/shared/shared-forms/reactive-file.component.scss b/client/src/app/shared/shared-forms/reactive-file.component.scssindex f9ba5805ad..a0afe1eee4 100644--- a/client/src/app/shared/shared-forms/reactive-file.component.scss+++ b/client/src/app/shared/shared-forms/reactive-file.component.scss@@ -19,15 +19,4 @@font-weight: $font-semibold;}-- .reset-button {- @include peertube-button;- @include grey-button;-- font-size: 80%;- margin-left: 5px;- line-height: initial;- padding: 2px 5px;- height: auto;- }}diff --git a/client/src/sass/class-helpers/_forms.scss b/client/src/sass/class-helpers/_forms.scssindex 1e78df947f..4e5c98aa8d 100644--- a/client/src/sass/class-helpers/_forms.scss+++ b/client/src/sass/class-helpers/_forms.scss@@ -49,7 +49,32 @@margin-top: 10px;}-label+.form-group-description {+// Useful with a "reset" button+.label-container {+ display: flex;+ white-space: nowrap;+ align-items: baseline;+}++label + .form-group-description,+.label-container + .form-group-description {margin-bottom: 10px;margin-top: 0;}++.reset-button {+ @include peertube-button;+ @include grey-button;++ height: auto;++ &.reset-button-small {+ font-size: 80%;+ padding: 2px 5px;+ margin: 0 0.25rem;+ height: fit-content;+ line-height: initial;+ }+}++diff --git a/server/server/controllers/api/videos/update.ts b/server/server/controllers/api/videos/update.tsindex 1c8cecba12..491175d743 100644--- a/server/server/controllers/api/videos/update.ts+++ b/server/server/controllers/api/videos/update.ts@@ -86,8 +86,10 @@ async function updateVideo (req: express.Request, res: express.Response) {if (videoInfoToUpdate[key] !== undefined) video.set(key, videoInfoToUpdate[key])}- if (videoInfoToUpdate.originallyPublishedAt !== undefined && videoInfoToUpdate.originallyPublishedAt !== null) {- video.originallyPublishedAt = new Date(videoInfoToUpdate.originallyPublishedAt)+ if (videoInfoToUpdate.originallyPublishedAt !== undefined) {+ video.originallyPublishedAt = videoInfoToUpdate.originallyPublishedAt+ ? new Date(videoInfoToUpdate.originallyPublishedAt)+ : null}// Privacy update?