Skip to content

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

Hide live scheduled date for past dates

Chocobozzzb221e8058bc8
diff --git a/client/src/app/+video-watch/shared/information/video-alert.component.html b/client/src/app/+video-watch/shared/information/video-alert.component.html
index 808f7d78e2..d49914a414 100644
--- a/client/src/app/+video-watch/shared/information/video-alert.component.html
+++ b/client/src/app/+video-watch/shared/information/video-alert.component.html
@@ -7,9 +7,10 @@
@if (isWaitingForLive()) {
<my-alert type="primary">
<div i18n>This live is not currently streaming.</div>
- @if (scheduledLiveDate()) {
+
+ @if (nextScheduledLiveDate()) {
<div i18n>
- It will start on {{ scheduledLiveDate() | ptDate: 'short' }}.
+ It will start on {{ nextScheduledLiveDate() | ptDate: 'short' }}.
</div>
}
</my-alert>
diff --git a/client/src/app/+video-watch/shared/information/video-alert.component.ts b/client/src/app/+video-watch/shared/information/video-alert.component.ts
index 74e73b8f09..abacd3b5ab 100644
--- a/client/src/app/+video-watch/shared/information/video-alert.component.ts
+++ b/client/src/app/+video-watch/shared/information/video-alert.component.ts
@@ -1,4 +1,4 @@
-import { Component, inject, input } from '@angular/core'
+import { Component, computed, inject, input } from '@angular/core'
import { AuthUser } from '@app/core'
import { AlertComponent } from '@app/shared/shared-main/common/alert.component'
import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'
@@ -19,6 +19,17 @@ export class VideoAlertComponent {
private readonly videoStateMessage = inject(VideoStateMessageService)
+ readonly nextScheduledLiveDate = computed(() => {
+ const liveSchedules = this.video()?.liveSchedules
+ if (!liveSchedules || liveSchedules.length === 0) return undefined
+
+ // Allow for a 10 minutes margin to the streamer
+ const minDate = new Date()
+ minDate.setMinutes(minDate.getMinutes() - 10)
+
+ return liveSchedules.find(schedule => new Date(schedule.startAt) > minDate)?.startAt
+ })
+
canSeeMoreStateInfo () {
return !!(this.user()?.hasRight(UserRight.UPDATE_ANY_VIDEO))
}
@@ -56,11 +67,4 @@ export class VideoAlertComponent {
isVideoPasswordProtected () {
return this.video()?.privacy.id === VideoPrivacy.PASSWORD_PROTECTED
}
-
- scheduledLiveDate () {
- const liveSchedules = this.video()?.liveSchedules
- if (!liveSchedules || liveSchedules.length === 0) return undefined
-
- return liveSchedules[0].startAt
- }
}