Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] feat(email): Recognize guests invited via email #13617

Merged
merged 14 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(emails): Fix integration tests assuming the email is the actorId
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Oct 23, 2024
commit 53b5cfe7977f493f16859d281edd485a0ab858aa
15 changes: 13 additions & 2 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,9 @@ protected function assertAttendeeList(string $identifier, ?TableNode $formData,
if (isset($expectedKeys['callId'])) {
$data['callId'] = (string)$attendee['callId'];
}
if (isset($expectedKeys['invitedActorId'], $attendee['invitedActorId'])) {
$data['invitedActorId'] = (string)$attendee['invitedActorId'];
}
if (isset($expectedKeys['status'], $attendee['status'])) {
$data['status'] = (string)$attendee['status'];
}
Expand Down Expand Up @@ -891,6 +894,9 @@ protected function assertAttendeeList(string $identifier, ?TableNode $formData,
if (isset($attendee['actorId']) && str_ends_with($attendee['actorId'], '@{$REMOTE_URL}')) {
$attendee['actorId'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $attendee['actorId']);
}
if (preg_match('/^SHA256\(([a-z0-9@.+\-]+)\)$/', $attendee['actorId'], $match)) {
$attendee['actorId'] = hash('sha256', $match[1]);
}

if (isset($attendee['actorId'], $attendee['actorType']) && $attendee['actorType'] === 'federated_users' && !str_contains($attendee['actorId'], '@')) {
$attendee['actorId'] .= '@' . rtrim($this->localRemoteServerUrl, '/');
Expand Down Expand Up @@ -928,6 +934,10 @@ protected function assertAttendeeList(string $identifier, ?TableNode $formData,
$attendee['participantType'] = (string)$this->mapParticipantTypeTestInput($attendee['participantType']);
}

if (isset($attendee['invitedActorId']) && $attendee['invitedActorId'] === 'ABSENT') {
unset($attendee['invitedActorId']);
}

if (isset($attendee['status']) && $attendee['status'] === 'ABSENT') {
unset($attendee['status']);
}
Expand Down Expand Up @@ -1382,9 +1392,10 @@ public function userResendsInvite(string $user, string $identifier, int $statusC
$body = null;
if ($formData instanceof TableNode) {
$attendee = $formData?->getRowsHash()['attendeeId'] ?? '';
if (isset(self::$userToAttendeeId[$identifier]['emails'][$attendee])) {
$actorId = hash('sha256', $attendee);
if (isset(self::$userToAttendeeId[$identifier]['emails'][$actorId])) {
$body = [
'attendeeId' => self::$userToAttendeeId[$identifier]['emails'][$attendee],
'attendeeId' => self::$userToAttendeeId[$identifier]['emails'][$actorId],
];
} elseif (str_starts_with($attendee, 'not-found')) {
$body = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Feature: conversation/invite-email
# Ref https://github.com/nextcloud/calendar/pull/5380
When user "participant1" adds email "[email protected]" 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 | [email protected] |
| 1 | 0 | users | participant1 |
| participantType | inCall | actorType | actorId | invitedActorId |
| 4 | 0 | emails | SHA256([email protected]) | [email protected] |
| 1 | 0 | users | participant1 | ABSENT |
# Reinvite all emails
When user "participant1" resends invite for room "room" with 200 (v4)
# Reinvite only one
Expand Down
48 changes: 24 additions & 24 deletions tests/integration/features/conversation-5/sip-dialin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,36 @@ Feature: conversation-2/sip-dialin
# Guests don't get a PIN as they can not be recognized and are deleted on leave
When user "guest" joins room "room" with 200 (v4)
Then user "participant1" sees the following attendees in room "room" with 200 (v4)
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | [email protected] | **PIN** |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | **PIN** |
| 3 | 0 | users | participant2 | **PIN** |
| 3 | 0 | users | participant3 | **PIN** |
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | SHA256([email protected]) | **PIN** |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | **PIN** |
| 3 | 0 | users | participant2 | **PIN** |
| 3 | 0 | users | participant3 | **PIN** |
When user "participant2" sets SIP state for room "room" to "disabled" with 403 (v4)
Then user "participant1" sees the following attendees in room "room" with 200 (v4)
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | [email protected] | **PIN** |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | **PIN** |
| 3 | 0 | users | participant2 | **PIN** |
| 3 | 0 | users | participant3 | **PIN** |
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | SHA256([email protected]) | **PIN** |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | **PIN** |
| 3 | 0 | users | participant2 | **PIN** |
| 3 | 0 | users | participant3 | **PIN** |
When user "participant1" sets SIP state for room "room" to "disabled" with 200 (v4)
Then user "participant1" sees the following attendees in room "room" with 200 (v4)
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | [email protected] | |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | |
| 3 | 0 | users | participant2 | |
| 3 | 0 | users | participant3 | |
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | SHA256([email protected]) | |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | |
| 3 | 0 | users | participant2 | |
| 3 | 0 | users | participant3 | |
When user "participant1" sets SIP state for room "room" to "no pin" with 200 (v4)
Then user "participant1" sees the following attendees in room "room" with 200 (v4)
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | [email protected] | **PIN** |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | **PIN** |
| 3 | 0 | users | participant2 | **PIN** |
| 3 | 0 | users | participant3 | **PIN** |
| participantType | inCall | actorType | actorId | attendeePin |
| 4 | 0 | emails | SHA256([email protected]) | **PIN** |
| 4 | 0 | guests | "guest" | |
| 1 | 0 | users | participant1 | **PIN** |
| 3 | 0 | users | participant2 | **PIN** |
| 3 | 0 | users | participant3 | **PIN** |

Scenario: Non-SIP admin tries to enable SIP
Given the following "spreed" app config is set
Expand Down