Skip to content

Commit dcebe2f

Browse files
sodu-parsievsodu
andauthored
added check if a user participates in a thread, if it is the user doesn't receive mention notifications bc the user already getting reply notification. Deleted thread() method from App\Models\reply because it doesn't work since reply has morphtomany relationship with App\Models\Thread (#940)
issue#937 Co-authored-by: sodu <sparsiev@firmidea.com>
1 parent 62eaf06 commit dcebe2f

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

app/Listeners/NotifyUsersMentionedInReply.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class NotifyUsersMentionedInReply
1212
public function handle(ReplyWasCreated $event): void
1313
{
1414
$event->reply->mentionedUsers()->each(function ($user) use ($event) {
15-
if (! $user->hasBlocked($event->reply->author())) {
15+
if (! $user->hasBlocked($event->reply->author()) && ! $event->reply->replyAble()->participants()->contains($user)) {
1616
$user->notify(new MentionNotification($event->reply));
1717
}
1818
});

app/Models/Reply.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ public function spamReportersRelation(): MorphToMany
155155
)->withTimestamps();
156156
}
157157

158-
public function thread(): BelongsTo
159-
{
160-
return $this->belongsTo(Thread::class);
161-
}
162-
163158
public function scopeIsSolution(Builder $builder): Builder
164159
{
165160
return $builder->has('solutionTo');

0 commit comments

Comments
 (0)