Skip Mail calendar sync for Meet rooms created by Ladill Events.
Deploy Ladill Meet / deploy (push) Successful in 2m1s
Deploy Ladill Meet / deploy (push) Successful in 2m1s
Events owns calendar entries for events-sourced rooms so virtual sessions do not duplicate on the webmail calendar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -200,6 +200,11 @@ class Room extends Model
|
||||
return \App\Support\EventsSourceLink::isLinked($this);
|
||||
}
|
||||
|
||||
public function isEventsSourced(): bool
|
||||
{
|
||||
return (($this->source ?? [])['app'] ?? '') === 'events';
|
||||
}
|
||||
|
||||
public function hasEventsRegistrationInvite(?string $email): bool
|
||||
{
|
||||
if ($email === null || trim($email) === '') {
|
||||
|
||||
@@ -20,7 +20,7 @@ class CalendarService
|
||||
|
||||
public function syncRoomCreated(Room $room, User $host): void
|
||||
{
|
||||
if (! $room->scheduled_at) {
|
||||
if (! $room->scheduled_at || $room->isEventsSourced()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class CalendarService
|
||||
|
||||
public function syncRoomUpdated(Room $room, User $host): void
|
||||
{
|
||||
if (! $room->scheduled_at) {
|
||||
if (! $room->scheduled_at || $room->isEventsSourced()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,10 @@ class CalendarService
|
||||
|
||||
public function syncRoomCancelled(Room $room, User $host): void
|
||||
{
|
||||
if ($room->isEventsSourced()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($mailbox = $this->resolveMailMailbox($host)) {
|
||||
if ($room->calendar_event_id) {
|
||||
$this->mail->deleteEventForMailbox($mailbox, $room);
|
||||
|
||||
@@ -769,6 +769,33 @@ class MeetWebTest extends TestCase
|
||||
});
|
||||
}
|
||||
|
||||
public function test_events_sourced_room_does_not_sync_to_mail_calendar(): void
|
||||
{
|
||||
\Illuminate\Support\Facades\Http::fake([
|
||||
'mail.ladill.com/*' => \Illuminate\Support\Facades\Http::response(['data' => ['id' => 99]], 201),
|
||||
]);
|
||||
|
||||
config([
|
||||
'meet.calendar.mail.api_url' => 'https://mail.ladill.com/api/service/v1',
|
||||
'meet.calendar.mail.api_key' => 'mail-test-key',
|
||||
]);
|
||||
|
||||
$room = $this->createRoom([
|
||||
'scheduled_at' => now()->addDay(),
|
||||
'source' => [
|
||||
'app' => 'events',
|
||||
'entity_type' => 'virtual_session',
|
||||
'entity_id' => 'vs-1',
|
||||
'event_id' => '42',
|
||||
],
|
||||
]);
|
||||
|
||||
app(\App\Services\Meet\CalendarService::class)->syncRoomCreated($room, $this->user);
|
||||
|
||||
\Illuminate\Support\Facades\Http::assertNothingSent();
|
||||
$this->assertNull($room->fresh()->calendar_event_id);
|
||||
}
|
||||
|
||||
public function test_host_can_create_conference(): void
|
||||
{
|
||||
$this->actingAs($this->user)
|
||||
|
||||
Reference in New Issue
Block a user