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
2 changes: 1 addition & 1 deletion app/Console/Commands/Support/GmailTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function handle(
'processing_mode' => 'manual_test',
'gmail_message_id' => 'test-'.SupportJson::correlationId(),
'gmail_thread_id' => 'test-thread-'.time(),
'subject' => trim((string) config('support_gmail.subject_prefix', '[CodeWeek Support]')).' [TEST] Support copilot dry run',
'subject' => trim((string) config('support_gmail.subject_prefix', 'codeweek-support')).' [TEST] Support copilot dry run',
'raw_message' => $message,
'forwarded_by_email' => $from,
'original_sender_email' => $from,
Expand Down
3 changes: 2 additions & 1 deletion config/support_gmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
'query' => env('SUPPORT_GMAIL_QUERY', 'newer_than:90d'),

// Only ingest messages whose subject contains this text (recommended over labels).
'subject_prefix' => env('SUPPORT_GMAIL_SUBJECT_PREFIX', '[CodeWeek Support]'),
// Production uses: SUPPORT_GMAIL_SUBJECT_PREFIX=codeweek-support
'subject_prefix' => env('SUPPORT_GMAIL_SUBJECT_PREFIX', 'codeweek-support'),

// Google OAuth client JSON: paste full JSON from Google Cloud (preferred on Forge; survives deploys).
'credentials' => env('SUPPORT_GMAIL_CREDENTIALS'),
Expand Down
5 changes: 5 additions & 0 deletions routes/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@
Schedule::command('app:export-search-data-to-json')->dailyAt('2:00');

Schedule::command('events:generate-recurring')->dailyAt('01:00');

// Support Gmail copilot: ingest tickets by subject (codeweek-support), run dry-run, email for APPROVE.
Schedule::command('support:gmail:poll --max=10')
->everyFiveMinutes()
->when(fn () => (bool) config('support_gmail.enabled'));
10 changes: 5 additions & 5 deletions tests/Unit/Support/SupportGmailPollQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ final class SupportGmailPollQueryTest extends TestCase
{
public function test_builds_query_with_subject_prefix(): void
{
config()->set('support_gmail.subject_prefix', '[CodeWeek Support]');
config()->set('support_gmail.subject_prefix', 'codeweek-support');
config()->set('support_gmail.query', 'newer_than:90d');

$this->assertSame(
'subject:"[CodeWeek Support]" newer_than:90d',
'subject:codeweek-support newer_than:90d',
SupportGmailPollQuery::resolve(),
);
}

public function test_skips_duplicate_subject_filter_when_query_already_has_one(): void
{
config()->set('support_gmail.subject_prefix', '[CodeWeek Support]');
config()->set('support_gmail.query', 'subject:"[CodeWeek Support]" newer_than:7d');
config()->set('support_gmail.subject_prefix', 'codeweek-support');
config()->set('support_gmail.query', 'subject:codeweek-support newer_than:7d');

$this->assertSame(
'subject:"[CodeWeek Support]" newer_than:7d',
'subject:codeweek-support newer_than:7d',
SupportGmailPollQuery::resolve(),
);
}
Expand Down