From bef0de3a012cec580c25038ce7912427e738074c Mon Sep 17 00:00:00 2001 From: smarcet Date: Fri, 30 Oct 2026 19:45:40 -0300 Subject: [PATCH] fix(events): stop mirroring streaming_url and overflow_streaming_url into each other SummitEvent::setOverflow() also wrote streaming_url and stream_is_secure, and setStreamingUrl() also wrote overflow_streaming_url, so an event could never hold a primary stream and a different overflow stream at the same time, and any caller of setStreamingUrl (the event factory, the presentation video processor) overwrote a live overflow URL. Nothing reads the mirrored values: the overflow readers (the public ?k= door, occupancy/overflow) read overflow_streaming_url only, and Room Occupancy sends the overflow URL explicitly on PUT .../overflow. Each setter now writes its own fields only. setOverflow keeps setting occupancy to OVERFLOW. Covered by SummitEventStreamingUrlTest. --- .../Foundation/Summit/Events/SummitEvent.php | 3 - .../Entities/SummitEventStreamingUrlTest.php | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 tests/Unit/Entities/SummitEventStreamingUrlTest.php diff --git a/app/Models/Foundation/Summit/Events/SummitEvent.php b/app/Models/Foundation/Summit/Events/SummitEvent.php index 9b29214377..5f40f83f3d 100644 --- a/app/Models/Foundation/Summit/Events/SummitEvent.php +++ b/app/Models/Foundation/Summit/Events/SummitEvent.php @@ -1426,7 +1426,6 @@ public function getStreamDuration(): int public function setStreamingUrl(?string $streaming_url): void { $this->streaming_url = $streaming_url; - $this->overflow_streaming_url = $streaming_url;; $key = $this->getSecureStreamCacheKey(); $this->skipDateUpdate(); if (Cache::tags(sprintf('secure_streams_%s', $this->summit->getId()))->has($key)) @@ -1994,8 +1993,6 @@ public function setOverflow(string $overflow_streaming_url, { $this->overflow_streaming_url = $overflow_streaming_url; $this->overflow_stream_is_secure = $overflow_stream_is_secure; - $this->streaming_url = $overflow_streaming_url; - $this->stream_is_secure = $overflow_stream_is_secure; $this->occupancy = self::OccupancyOverflow; $this->skipDateUpdate(); } diff --git a/tests/Unit/Entities/SummitEventStreamingUrlTest.php b/tests/Unit/Entities/SummitEventStreamingUrlTest.php new file mode 100644 index 0000000000..ee73acfcd2 --- /dev/null +++ b/tests/Unit/Entities/SummitEventStreamingUrlTest.php @@ -0,0 +1,66 @@ +addEvent($event); + return $event; + } + + public function testSetOverflowLeavesThePrimaryStreamUntouched(): void + { + $event = $this->eventWithSummit(); + $event->setStreamingUrl(self::PrimaryUrl); + $event->setStreamIsSecure(false); + + $event->setOverflow(self::OverflowUrl, true); + + $this->assertEquals(self::OverflowUrl, $event->getOverflowStreamingUrl()); + $this->assertTrue($event->getOverflowStreamIsSecure()); + $this->assertEquals(SummitEvent::OccupancyOverflow, $event->getOccupancy()); + + $this->assertEquals(self::PrimaryUrl, $event->getStreamingUrl(), 'setOverflow must not overwrite streaming_url'); + $this->assertFalse($event->IsSecureStream(), 'setOverflow must not overwrite stream_is_secure'); + } + + public function testSetStreamingUrlLeavesTheOverflowStreamUntouched(): void + { + $event = $this->eventWithSummit(); + $event->setOverflow(self::OverflowUrl, true); + + $event->setStreamingUrl(self::PrimaryUrl); + + $this->assertEquals(self::PrimaryUrl, $event->getStreamingUrl()); + $this->assertEquals(self::OverflowUrl, $event->getOverflowStreamingUrl(), 'setStreamingUrl must not overwrite overflow_streaming_url'); + } +}