Skip to content

Commit 4727552

Browse files
simonhampclaude
andauthored
Link notification preferences in email to settings page (#341)
Replace plain text "manage your notification preferences" line with a direct markdown link to /dashboard/settings?tab=notifications in the NewPluginAvailable email notification. Add test coverage for the link. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 60342eb commit 4727552

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

app/Notifications/NewPluginAvailable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function toMail(object $notifiable): MailMessage
3535
->greeting('A new plugin is available!')
3636
->line("**{$this->plugin->name}** has just been added to the NativePHP Plugin Marketplace.")
3737
->action('View Plugin', route('plugins.show', $this->plugin->routeParams()))
38-
->line('You can manage your notification preferences in your account settings.');
38+
->line('[Manage your notification preferences]('.route('customer.settings', ['tab' => 'notifications']).').');
3939
}
4040

4141
/**

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Feature/Notifications/NewPluginAvailableTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,22 @@ public function test_database_notification_contains_plugin_data(): void
115115
$this->assertEquals('View Plugin', $data['action_label']);
116116
}
117117

118+
public function test_mail_contains_notification_preferences_link(): void
119+
{
120+
$user = User::factory()->create();
121+
$plugin = Plugin::factory()->for($user)->create();
122+
123+
$notification = new NewPluginAvailable($plugin);
124+
$mail = $notification->toMail($user);
125+
126+
$expectedUrl = route('customer.settings', ['tab' => 'notifications']);
127+
$found = collect($mail->introLines)->concat($mail->outroLines)->contains(function ($line) use ($expectedUrl) {
128+
return str_contains($line, $expectedUrl);
129+
});
130+
131+
$this->assertTrue($found, 'Mail should contain a link to the notification preferences page.');
132+
}
133+
118134
public function test_new_users_receive_new_plugin_notifications_by_default(): void
119135
{
120136
$user = User::factory()->create();

0 commit comments

Comments
 (0)