Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

fix(check-in): hide attendee email from public resource (#1229)

Ridwan Agudaf7f29fa0d747
diff --git a/backend/app/Resources/Attendee/AttendeeWithCheckInPublicResource.php b/backend/app/Resources/Attendee/AttendeeWithCheckInPublicResource.php
index 198bf3f1f..4bca6bd83 100644
--- a/backend/app/Resources/Attendee/AttendeeWithCheckInPublicResource.php
+++ b/backend/app/Resources/Attendee/AttendeeWithCheckInPublicResource.php
@@ -16,7 +16,6 @@ class AttendeeWithCheckInPublicResource extends JsonResource
{
return [
'id' => $this->getId(),
- 'email' => $this->getEmail(),
'first_name' => $this->getFirstName(),
'last_name' => $this->getLastName(),
'public_id' => $this->getPublicId(),
diff --git a/backend/tests/Unit/Resources/Attendee/AttendeeWithCheckInPublicResourceTest.php b/backend/tests/Unit/Resources/Attendee/AttendeeWithCheckInPublicResourceTest.php
new file mode 100644
index 000000000..1780da099
--- /dev/null
+++ b/backend/tests/Unit/Resources/Attendee/AttendeeWithCheckInPublicResourceTest.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Tests\Unit\Resources\Attendee;
+
+use HiEvents\DomainObjects\AttendeeDomainObject;
+use HiEvents\Resources\Attendee\AttendeeWithCheckInPublicResource;
+use Illuminate\Http\Request;
+use Tests\TestCase;
+
+class AttendeeWithCheckInPublicResourceTest extends TestCase
+{
+ public function test_public_check_in_attendee_resource_excludes_email(): void
+ {
+ $attendee = (new AttendeeDomainObject())
+ ->setId(1)
+ ->setOrderId(10)
+ ->setProductId(20)
+ ->setProductPriceId(30)
+ ->setEmail('[email protected]')
+ ->setFirstName('Jane')
+ ->setLastName('Attendee')
+ ->setPublicId('A-12345')
+ ->setStatus('ACTIVE');
+
+ $resource = (new AttendeeWithCheckInPublicResource($attendee))->toArray(Request::create('/'));
+
+ $this->assertArrayNotHasKey('email', $resource);
+ $this->assertSame('Jane', $resource['first_name']);
+ $this->assertSame('Attendee', $resource['last_name']);
+ $this->assertSame('A-12345', $resource['public_id']);
+ $this->assertSame(10, $resource['order_id']);
+ }
+}
diff --git a/frontend/src/components/common/CheckIn/AttendeeList.tsx b/frontend/src/components/common/CheckIn/AttendeeList.tsx
index 7662b397a..001ccbb96 100644
--- a/frontend/src/components/common/CheckIn/AttendeeList.tsx
+++ b/frontend/src/components/common/CheckIn/AttendeeList.tsx
@@ -83,9 +83,6 @@ export const AttendeeList = ({
{t`Ticket Cancelled`}
</div>
) : null}
- <div style={{fontSize: '0.8em', color: '#555'}}>
- {attendee.email}
- </div>
{isAttendeeAwaitingPayment && (
<div className={classes.awaitingPayment}>
{t`Awaiting payment`}