Skip to content

Commit 60a02ab

Browse files
committed
fix: deleting/deactivating user warnings
The notification message assumes it's for a torrent, which is not the case for user warnings.
1 parent aeac571 commit 60a02ab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/Http/Livewire/UserWarnings.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ final public function deactivate(Warning $warning): void
128128
'active' => false,
129129
]);
130130

131-
$this->user->notify(new WarningDeactivated($staff, $warning));
131+
if ($warning->torrent()->exists()) {
132+
$this->user->notify(new WarningDeactivated($staff, $warning));
133+
}
132134

133135
$this->dispatch('success', type: 'success', message: 'Warning was successfully deactivated');
134136
}
@@ -187,7 +189,9 @@ final public function destroy(Warning $warning): void
187189

188190
$warning->delete();
189191

190-
$this->user->notify(new WarningTorrentDeleted($staff, $warning));
192+
if ($warning->torrent->exists()) {
193+
$this->user->notify(new WarningTorrentDeleted($staff, $warning));
194+
}
191195

192196
$this->dispatch('success', type: 'success', message: 'Warning was successfully deleted');
193197
}

0 commit comments

Comments
 (0)