Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/Service/Proposal/ProposalService.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ public function convertProposal(IUser $user, int $proposalId, int $dateId, array
$vObject->serialize()
);
}
$this->applyCalendarBlockersParticipant($user, $proposal, 'M', $vObject);

// destroy the proposal entry
$this->proposalVoteMapper->deleteByProposalId($user->getUID(), $proposal->getId());
Expand Down Expand Up @@ -633,7 +634,7 @@ private function syncCalendarBlockers(IUser $user, ProposalObject $proposal, str
$vObject = $this->constructCalendarBlocker($user, $proposal);

$this->applyCalendarBlockersOrganizer($user, $userCalendarUri, $userEventUri, $vObject);
$this->applyCalendarBlockersParticipant($user, $proposal, $reason, $userCalendarUri, $userEventUri, $vObject);
$this->applyCalendarBlockersParticipant($user, $proposal, $reason, $vObject);

}

Expand Down Expand Up @@ -720,7 +721,7 @@ private function deleteCalendarBlockersOrganizer(IUser $user, string $calendarUr
/**
* Create or update calendar blocker event(s) for participant(s)
*/
private function applyCalendarBlockersParticipant(IUser $user, ProposalObject $proposal, string $reason, string $calendarUri, ?string $eventUri, VCalendar $vObject): void {
private function applyCalendarBlockersParticipant(IUser $user, ProposalObject $proposal, string $reason, VCalendar $vObject): void {
// if the calendar manager does not have a handleIMip method, we cannot generate iTip messages
if (!method_exists($this->calendarManager, 'handleIMip')) {
return;
Expand Down
10 changes: 10 additions & 0 deletions tests/php/unit/Service/Proposal/ProposalServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,16 @@ public function testConvertProposalSuccess(): void {
->method('deleteById')
->with('testuser', 1);

// the internal participant must be looked up and notified of the finalised event via iTIP
$participantUser = $this->createMock(IUser::class);
$participantUser->method('getUID')->willReturn('alice');
$this->userManager->expects($this->once())
->method('getByEmail')
->with('alice@example.com')
->willReturn([$participantUser]);
$this->calendarManager->expects($this->once())
->method('handleIMip');

// test and assertions
$this->service->convertProposal($this->user, 1, 10, ['attendancePreset' => true]);
$this->addToAssertionCount(1); // If we reached this point, the test is successfully completed
Expand Down
Loading