Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Aug 28, 2024
1 parent 6acada9 commit 6d3b393
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Listeners/NotifyUsersMentionedInThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
final class NotifyUsersMentionedInThread
{
public function handle(ThreadWasCreated $event): void
{
{dd('test');
$event->thread->mentionedUsers()->each(function ($user) use ($event) {
if (! $user->isNotificationAllowed(MentionNotification::class)) {
return;
Expand Down
19 changes: 14 additions & 5 deletions tests/Feature/ReplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,20 @@
'replyable_type' => Thread::TABLE,
]);

$notification = DatabaseNotification::first();
$this->assertSame($user->id, (int) $notification->notifiable_id);
$this->assertSame('users', $notification->notifiable_type);
$this->assertSame('mention', $notification->data['type']);
$this->assertSame('The first thread', $notification->data['replyable_subject']);
$tested = false;

foreach (DatabaseNotification::all() as $notification) {
if ($notification->type === MentionNotification::class) {
$this->assertSame($user->id, (int) $notification->notifiable_id);
$this->assertSame('users', $notification->notifiable_type);
$this->assertSame('mention', $notification->data['type']);
$this->assertSame('The first thread', $notification->data['replyable_subject']);

$tested = true;
}
}

$this->assertTrue($tested);
})->only();

test('users are not notified when mentioned in an edited reply', function () {
Expand Down

0 comments on commit 6d3b393

Please sign in to comment.