Skip to content

Commit

Permalink
Prevent import of events where the token id matches an existing event (
Browse files Browse the repository at this point in the history
  • Loading branch information
irby authored Dec 4, 2024
1 parent e1d4b0c commit d10df1b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function mapIntoEventData(array $data): EventData
},
'rsvp' => $event['going'],
'service' => EventServices::MeetupGraphql,
'service_id' => $event['id'],
'service_id' => $event['token'] ?? $event['id'],
'venue' => $this->mapIntoVenueData($data),
]);

Expand Down
20 changes: 20 additions & 0 deletions app-modules/event-importer/tests/Feature/MeetupGraphqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function test_online_event_venue_is_null(): void

$event = $this->queryEvent('pwdqjtygcpbkb');

$this->assertNotNull($event);
$this->assertNull($event->venue);
}

Expand All @@ -131,6 +132,25 @@ public function test_upcoming_meetup_event_past_max_days_not_imported(): void
$this->assertNull($event);
}

public function test_duplicate_event_is_not_imported(): void
{
$this->runImportCommand();

Event::factory()->create([
'service' => EventServices::MeetupGraphql,
'service_id' => '306527183',
'updated_at' => now()->subDays(1),
]);

$event_original = $this->queryEvent('306527183');
$this->assertNotNull($event_original);

$this->assertEquals(now(), $event_original->updated_at);

$event_duplicate = $this->queryEvent('mfuaiakmcxuzjsd');
$this->assertNull($event_duplicate);
}

public function test_config_validation_fails_with_missing_client_id(): void
{
config()->set('event-import-handlers.meetup_graphql_client_id', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
"cursor": "MzAyMTkwMDU3OjE3MjI1NDk2MDAwMDA=",
"node": {
"id": "302190057",
"token": "302190057",
"title": "DEF CON 864 Meeting",
"eventUrl": "https://www.meetup.com/defcon864/events/302190057",
"description": "Join us for the monthly DEF CON 864 group meeting online and in-person.\n\n* Online details are posted in our Discord.\n* Discord invite is on our website at dc864.org.\n\nAll meetings are free and open to the public.\n\nWe have a very open format, so join in and let us know what your interests are that you'd like to see from this group.\n\nWe leave an hour to going over member projects and interests. Have a Raspberry Pi project or build a custom drone? Bring it in and show us how you did it. Creating your own set of scripts for system reconnaissance? We'd love to see it.",
Expand Down Expand Up @@ -273,6 +272,32 @@
"lng": -82.29995
}
}
},
{
"cursor": "cHdkcWp0eWdjcWJoYjoxNzMzNDM5NjAwMDAy",
"node": {
"id": "mfuaiakmcxuzjsd",
"token": "306527183",
"title": "DEF CON 864 Meeting",
"eventUrl": "https://www.meetup.com/defcon864/events/mfuaiakmcxuzjsd",
"description": "Join us for the monthly DEF CON 864 group meeting online and in-person.\n\n* Online details are posted in our Discord.\n* Discord invite is on our website at dc864.org.\n\nAll meetings are free and open to the public.\n\nWe have a very open format, so join in and let us know what your interests are that you'd like to see from this group.\n\nWe leave an hour to going over member projects and interests. Have a Raspberry Pi project or build a custom drone? Bring it in and show us how you did it. Creating your own set of scripts for system reconnaissance? We'd love to see it.",
"dateTime": "2020-01-10T18:00-05:00",
"eventType": "PHYSICAL",
"status": "published",
"going": 2,
"createdAt": null,
"venue": {
"id": "26458417",
"name": "1508 Pelham Rd",
"address": "1508 Pelham Rd",
"city": "Greenville",
"state": "SC",
"postalCode": "29615",
"country": "us",
"lat": 34.857014,
"lng": -82.29995
}
}
}
],
"pageInfo": {
Expand Down

0 comments on commit d10df1b

Please sign in to comment.