summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Controller/RoomController.php3
-rw-r--r--lib/Service/ParticipantService.php11
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php36
-rw-r--r--tests/integration/features/conversation/invite-email.feature21
4 files changed, 70 insertions, 1 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 37e9c873e..be1cf7e6b 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -1441,6 +1441,7 @@ class RoomController extends AEnvironmentAwareController {
#[NoAdminRequired]
#[RequireModeratorParticipant]
public function resendInvitations(?int $attendeeId): DataResponse {
+ /** @var Participant[] $participants */
$participants = [];
// targeting specific participant
@@ -1451,7 +1452,7 @@ class RoomController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
} else {
- $participants = $this->participantService->getActorsByType($this->room, Attendee::ACTOR_EMAILS);
+ $participants = $this->participantService->getParticipantsByActorType($this->room, Attendee::ACTOR_EMAILS);
}
foreach ($participants as $participant) {
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index 35a565267..de482b494 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -811,6 +811,9 @@ class ParticipantService {
}
}
+ /**
+ * @return Attendee[]
+ */
public function getActorsByType(Room $room, string $actorType): array {
return $this->attendeeMapper->getActorsByType($room->getId(), $actorType);
}
@@ -1386,6 +1389,14 @@ class ParticipantService {
}
/**
+ * @return Participant[]
+ */
+ public function getParticipantsByActorType(Room $room, string $actorType): array {
+ $attendees = $this->getActorsByType($room, $actorType);
+ return array_map(static fn (Attendee $attendee) => new Participant($room, $attendee, null), $attendees);
+ }
+
+ /**
* @param IQueryBuilder $query
* @param Room $room
* @return Participant[]
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 97d7456d1..2a53674f3 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -1068,6 +1068,42 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @Then /^user "([^"]*)" resends invite for room "([^"]*)" with (\d+) \((v4)\)$/
+ *
+ * @param string $user
+ * @param string $identifier
+ * @param int $statusCode
+ * @param string $apiVersion
+ * @param TableNode|null $formData
+ */
+ public function userResendsInvite(string $user, string $identifier, int $statusCode, string $apiVersion, TableNode $formData = null): void {
+ $this->setCurrentUser($user);
+
+ /** @var ?array $body */
+ $body = null;
+ if ($formData instanceof TableNode) {
+ $attendee = $formData?->getRowsHash()['attendeeId'] ?? '';
+ if (isset(self::$userToAttendeeId[$identifier]['emails'][$attendee])) {
+ $body = [
+ 'attendeeId' => self::$userToAttendeeId[$identifier]['emails'][$attendee],
+ ];
+ } elseif (str_starts_with($attendee, 'not-found')) {
+ $body = [
+ 'attendeeId' => max(self::$userToAttendeeId[$identifier]['emails']) + 1000,
+ ];
+ } else {
+ throw new \InvalidArgumentException('Unknown attendee, did you pull participants?');
+ }
+ }
+
+ $this->sendRequest(
+ 'POST', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/participants/resend-invitations',
+ $body
+ );
+ $this->assertStatusCode($this->response, $statusCode);
+ }
+
+ /**
* @Then /^user "([^"]*)" sets session state to (\d) in room "([^"]*)" with (\d+) \((v4)\)$/
*
* @param string $user
diff --git a/tests/integration/features/conversation/invite-email.feature b/tests/integration/features/conversation/invite-email.feature
new file mode 100644
index 000000000..415ff4054
--- /dev/null
+++ b/tests/integration/features/conversation/invite-email.feature
@@ -0,0 +1,21 @@
+Feature: conversation/invite-email)
+ Background:
+ Given user "participant1" exists
+
+ Scenario: Resend email invites
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 3 |
+ | roomName | room |
+ When user "participant1" adds email "test@example.tld" to room "room" with 200 (v4)
+ Then user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | participantType | inCall | actorType | actorId |
+ | 4 | 0 | emails | test@example.tld |
+ | 1 | 0 | users | participant1 |
+ # Reinvite all emails
+ When user "participant1" resends invite for room "room" with 200 (v4)
+ # Reinvite only one
+ When user "participant1" resends invite for room "room" with 200 (v4)
+ | attendeeId | test@example.tld |
+ # Reinvite failure
+ When user "participant1" resends invite for room "room" with 404 (v4)
+ | attendeeId | not-found@example.tld |