mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 20:18:59 -05:00
(Update) FollowController
Check if user notify should happen based on permissions.
This commit is contained in:
@@ -53,9 +53,9 @@ class FollowController extends Controller
|
||||
$follow->user_id = auth()->user()->id;
|
||||
$follow->target_id = $user->id;
|
||||
$follow->save();
|
||||
|
||||
$user->notify(new NewFollow('user', auth()->user()->username, $follow));
|
||||
|
||||
if ($user->acceptsNotification(auth()->user(),$user,'account','show_account_follow')) {
|
||||
$user->notify(new NewFollow('user', auth()->user(), $user, $follow));
|
||||
}
|
||||
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
|
||||
->with($this->toastr->success('You are now following '.$user->username, 'Yay!', ['options']));
|
||||
} else {
|
||||
@@ -76,9 +76,9 @@ class FollowController extends Controller
|
||||
if (auth()->user()->isFollowing($user->id)) {
|
||||
$follow = auth()->user()->follows()->where('target_id', '=', $user->id)->first();
|
||||
$follow->delete();
|
||||
|
||||
$user->notify(new NewUnfollow('user', auth()->user()->username, auth()->user()->id));
|
||||
|
||||
if ($user->acceptsNotification(auth()->user(),$user,'account','show_account_unfollow')) {
|
||||
$user->notify(new NewUnfollow('user', auth()->user(), $user, $follow));
|
||||
}
|
||||
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
|
||||
->with($this->toastr->success('You are no longer following '.$user->username, 'Yay!', ['options']));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user