Skip to content

Commit

Permalink
fix(freebusy): fixes busy status not shown in thunderbird
Browse files Browse the repository at this point in the history
  • Loading branch information
SurajDadral committed Nov 14, 2024
1 parent c8ef5fd commit 5c6cb6c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
7 changes: 1 addition & 6 deletions lib/FreeBusyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,7 @@ protected function generateFreeBusyCalendar(FreeBusyData $fbData): VCalendar
'FREEBUSY',
$busyTime[0]->format('Ymd\\THis\\Z').'/'.$busyTime[1]->format('Ymd\\THis\\Z')
);

// Only setting FBTYPE if it's not BUSY, because BUSY is the
// default anyway.
if ('BUSY' !== $busyType) {
$prop['FBTYPE'] = $busyType;
}
$prop['FBTYPE'] = $busyType;
$vfreebusy->add($prop);
}

Expand Down
38 changes: 19 additions & 19 deletions tests/VObject/FreeBusyGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testSimple(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T120000Z/20110101T130000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z',
$blob
);
}
Expand All @@ -115,7 +115,7 @@ public function testSource(): void
rewind($h);

self::assertFreeBusyReport(
'FREEBUSY:20110101T120000Z/20110101T130000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z',
$h
);
}
Expand All @@ -137,7 +137,7 @@ public function testOpaque(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T130000Z/20110101T140000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T130000Z/20110101T140000Z',
$blob
);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public function testDuration(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T190000Z/20110101T200000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T190000Z/20110101T200000Z',
$blob
);
}
Expand All @@ -293,7 +293,7 @@ public function testAllDay(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110102T000000Z/20110103T000000Z',
'FREEBUSY;FBTYPE=BUSY:20110102T000000Z/20110103T000000Z',
$blob
);
}
Expand Down Expand Up @@ -336,7 +336,7 @@ public function testObject(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T210000Z/20110101T220000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T210000Z/20110101T220000Z',
Reader::read($blob)
);
}
Expand All @@ -360,8 +360,8 @@ public function testVFreeBusy(): void
ICS;

self::assertFreeBusyReport(
"FREEBUSY:20110103T010000Z/20110103T020000Z\n".
'FREEBUSY:20110103T030000Z/20110103T060000Z',
"FREEBUSY;FBTYPE=BUSY:20110103T010000Z/20110103T020000Z\n".
'FREEBUSY;FBTYPE=BUSY:20110103T030000Z/20110103T060000Z',
$blob
);
}
Expand All @@ -381,7 +381,7 @@ public function testYearlyRecurrence(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T220000Z/20110101T230000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T220000Z/20110101T230000Z',
$blob
);
}
Expand All @@ -401,7 +401,7 @@ public function testYearlyRecurrenceDuration(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T230000Z/20110102T000000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T230000Z/20110102T000000Z',
$blob
);
}
Expand All @@ -420,7 +420,7 @@ public function testFloatingTime(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T120000Z/20110101T130000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z',
$blob
);
}
Expand All @@ -439,7 +439,7 @@ public function testFloatingTimeReferenceTimeZone(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T170000Z/20110101T180000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T170000Z/20110101T180000Z',
$blob,
new \DateTimeZone('America/Toronto')
);
Expand All @@ -458,7 +458,7 @@ public function testAllDay2(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T110000Z/20110102T000000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T110000Z/20110102T000000Z',
$blob
);
}
Expand All @@ -476,7 +476,7 @@ public function testAllDayReferenceTimeZone(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T110000Z/20110102T050000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T110000Z/20110102T050000Z',
$blob,
new \DateTimeZone('America/Toronto')
);
Expand Down Expand Up @@ -534,7 +534,7 @@ public function testVAvailabilitySimple(): void

self::assertFreeBusyReport(
"FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20110101T110000Z/20110101T120000Z\n".
"FREEBUSY:20110101T120000Z/20110101T130000Z\n".
"FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z\n".
'FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20110101T130000Z/20110103T110000Z',
$blob,
null,
Expand Down Expand Up @@ -572,7 +572,7 @@ public function testVAvailabilityIrrelevant(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T120000Z/20110101T130000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z',
$blob,
null,
$vavail
Expand Down Expand Up @@ -612,7 +612,7 @@ public function testVAvailabilityOfficeHours(): void

self::assertFreeBusyReport(
"FREEBUSY;FBTYPE=BUSY-TENTATIVE:20110101T110000Z/20110101T120000Z\n".
"FREEBUSY:20110101T120000Z/20110101T130000Z\n".
"FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z\n".
"FREEBUSY;FBTYPE=BUSY-TENTATIVE:20110101T130000Z/20110103T090000Z\n",
$blob,
null,
Expand Down Expand Up @@ -659,7 +659,7 @@ public function testVAvailabilityOfficeHoursVacation(): void
ICS;

self::assertFreeBusyReport(
'FREEBUSY:20110101T110000Z/20110103T110000Z',
'FREEBUSY;FBTYPE=BUSY:20110101T110000Z/20110103T110000Z',
$blob,
null,
$vavail
Expand Down Expand Up @@ -708,7 +708,7 @@ public function testVAvailabilityOfficeHoursVacation2(): void

self::assertFreeBusyReport(
"FREEBUSY;FBTYPE=BUSY-TENTATIVE:20110101T110000Z/20110101T120000Z\n".
"FREEBUSY:20110101T120000Z/20110101T130000Z\n".
"FREEBUSY;FBTYPE=BUSY:20110101T120000Z/20110101T130000Z\n".
"FREEBUSY;FBTYPE=BUSY-TENTATIVE:20110101T130000Z/20110103T090000Z\n",
$blob,
null,
Expand Down

0 comments on commit 5c6cb6c

Please sign in to comment.