mirror of
https://github.com/flarum/core.git
synced 2025-08-09 09:57:06 +02:00
Don't allow re-liking or re-unliking
This commit is contained in:
@@ -29,11 +29,13 @@ class PersistData
|
||||
throw new PermissionDeniedException;
|
||||
}
|
||||
|
||||
if ($liked) {
|
||||
$currentlyLiked = $post->likes()->where('user_id', $actor->id)->exists();
|
||||
|
||||
if ($liked && ! $currentlyLiked) {
|
||||
$post->likes()->attach($actor->id);
|
||||
|
||||
$post->raise(new PostWasLiked($post, $actor));
|
||||
} else {
|
||||
} elseif ($currentlyLiked) {
|
||||
$post->likes()->detach($actor->id);
|
||||
|
||||
$post->raise(new PostWasUnliked($post, $actor));
|
||||
|
Reference in New Issue
Block a user