A platform for community discussion. Free, open, simple.
FIX: Unable to join Zoom on multi-day livestream event (#42754)
Martin Brennan6965bdb69f78
diff --git a/plugins/discourse-events/assets/javascripts/discourse/models/discourse-post-event-event.js b/plugins/discourse-events/assets/javascripts/discourse/models/discourse-post-event-event.jsindex 16900493ca9..d6101300918 100644--- a/plugins/discourse-events/assets/javascripts/discourse/models/discourse-post-event-event.js+++ b/plugins/discourse-events/assets/javascripts/discourse/models/discourse-post-event-event.js@@ -20,7 +20,15 @@ const DEFAULT_REMINDER = {const EARLY_ACCESS_MINUTES = 30;const GRACE_PERIOD_MINUTES = 10;-export function isPastEventTimeframe(endsAt) {+export function isPastEventTimeframe(allDay, startsAt, endsAt) {+ if (allDay) {+ if (!startsAt && !endsAt) {+ return false;+ }++ return moment().isAfter(moment(endsAt || startsAt).endOf("day"));+ }+if (!endsAt) {return false;}@@ -211,7 +219,7 @@ export default class DiscoursePostEventEvent {}get pastEventTimeframe() {- return isPastEventTimeframe(this.endsAt);+ return isPastEventTimeframe(this.allDay, this.startsAt, this.endsAt);}updateFromEvent(event) {diff --git a/plugins/discourse-events/assets/javascripts/discourse/services/embeddable-chat.gjs b/plugins/discourse-events/assets/javascripts/discourse/services/embeddable-chat.gjsindex 55fc27ea737..29ab1347d21 100644--- a/plugins/discourse-events/assets/javascripts/discourse/services/embeddable-chat.gjs+++ b/plugins/discourse-events/assets/javascripts/discourse/services/embeddable-chat.gjs@@ -97,7 +97,10 @@ export default class EmbeddableChat extends Service {(post) => post.post_number === 1)?.event;- return !!event?.is_zoom_livestream && !isPastEventTimeframe(event.ends_at);+ return (+ !!event?.is_zoom_livestream &&+ !isPastEventTimeframe(event.all_day, event.starts_at, event.ends_at)+ );}get topicController() {diff --git a/plugins/discourse-events/test/javascripts/integration/components/zoom-entry-test.gjs b/plugins/discourse-events/test/javascripts/integration/components/zoom-entry-test.gjsindex e04b0ea577f..5f986ffd032 100644--- a/plugins/discourse-events/test/javascripts/integration/components/zoom-entry-test.gjs+++ b/plugins/discourse-events/test/javascripts/integration/components/zoom-entry-test.gjs@@ -3,7 +3,9 @@ import { click, render } from "@ember/test-helpers";import { module, test } from "qunit";import sinon from "sinon";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import { fakeTime } from "discourse/tests/helpers/qunit-helpers";import LivestreamZoomEntry from "../../discourse/components/livestream/zoom-entry";+import DiscoursePostEventEvent from "../../discourse/models/discourse-post-event-event";const JOIN_BUTTON_SELECTOR =".discourse-calendar-livestream-zoom-entry .discourse-calendar-livestream-zoom-entry__join";@@ -87,6 +89,58 @@ module("Integration | Component | LivestreamZoomEntry", function (hooks) {.hasText("You can join the webinar closer to the event start time");});+ test("allows joining a multi-day all-day event through its end date", async function (assert) {+ const clock = fakeTime("2026-08-20T12:00:00Z", "UTC");+ this.event = DiscoursePostEventEvent.create({+ id: 42,+ starts_at: "2026-08-19T00:00:00Z",+ ends_at: "2026-08-21T00:00:00Z",+ all_day: true,+ livestream_chat_channel_id: 9,+ post: { topic: { id: 1, slug: "test-topic", chat_channel_id: 9 } },+ });++ try {+ await render(+ <template><LivestreamZoomEntry @event={{this.event}} /></template>+ );++ assert+ .dom(JOIN_BUTTON_SELECTOR)+ .hasAttribute(+ "href",+ "/t/test-topic/1/zoom",+ "the event remains joinable between its start and end dates"+ );+ } finally {+ clock.restore();+ }+ });++ test("renders nothing after a multi-day all-day event's end date", async function (assert) {+ const clock = fakeTime("2026-08-22T12:00:00Z", "UTC");+ this.event = DiscoursePostEventEvent.create({+ id: 42,+ starts_at: "2026-08-19T00:00:00Z",+ ends_at: "2026-08-21T00:00:00Z",+ all_day: true,+ livestream_chat_channel_id: 9,+ post: { topic: { id: 1, slug: "test-topic", chat_channel_id: 9 } },+ });++ try {+ await render(+ <template><LivestreamZoomEntry @event={{this.event}} /></template>+ );++ assert+ .dom(".discourse-calendar-livestream-zoom-entry")+ .doesNotExist("the event is past after its final day");+ } finally {+ clock.restore();+ }+ });+test("renders nothing once the event is past its grace period", async function (assert) {this.event.pastEventTimeframe = true;diff --git a/plugins/discourse-events/test/javascripts/unit/models/discourse-post-event-event-test.js b/plugins/discourse-events/test/javascripts/unit/models/discourse-post-event-event-test.jsindex 8fcf87f231d..c7f4e56646c 100644--- a/plugins/discourse-events/test/javascripts/unit/models/discourse-post-event-event-test.js+++ b/plugins/discourse-events/test/javascripts/unit/models/discourse-post-event-event-test.js@@ -130,7 +130,7 @@ module("Unit | Model | DiscoursePostEventEvent", function () {const allDayEvent = DiscoursePostEventEvent.create({id: 1,starts_at: startsAt,- ends_at: null,+ ends_at: startsAt,all_day: true,});@@ -185,6 +185,30 @@ module("Unit | Model | DiscoursePostEventEvent", function () {);});+ test("pastEventTimeframe uses the end date for multi-day all-day events", function (assert) {+ const ongoingEvent = DiscoursePostEventEvent.create({+ id: 1,+ starts_at: moment().subtract(2, "days").startOf("day").toISOString(),+ ends_at: moment().endOf("day").toISOString(),+ all_day: true,+ });+ const pastEvent = DiscoursePostEventEvent.create({+ id: 2,+ starts_at: moment().subtract(2, "days").startOf("day").toISOString(),+ ends_at: moment().subtract(1, "day").endOf("day").toISOString(),+ all_day: true,+ });++ assert.false(+ ongoingEvent.pastEventTimeframe,+ "the event remains active through its end date"+ );+ assert.true(+ pastEvent.pastEventTimeframe,+ "the event is past after its end date"+ );+ });+test("isWithinEventTimeframe returns false for all-day events on a different day", function (assert) {const startsAt = moment().add(1, "day").toISOString();const allDayEvent = DiscoursePostEventEvent.create({