mirror of
https://github.com/flarum/core.git
synced 2025-08-08 01:16:52 +02:00
Unset tags relation after setting (#131)
This ensures that the proper tag values are returned to the API by clearing any cached tags before returning a response. It also makes sure that the listeners to the `DiscussionWasTagged` event won't have old data under `$event->discussion->tags`. Fixes https://github.com/flarum/core/issues/2514
This commit is contained in:
committed by
GitHub
parent
3635dbad19
commit
8468a05b87
@@ -118,6 +118,7 @@ class SaveTagsToDatabase
|
||||
|
||||
$discussion->afterSave(function ($discussion) use ($newTagIds) {
|
||||
$discussion->tags()->sync($newTagIds);
|
||||
$discussion->unsetRelation('tags');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user