1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +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:
Alexander Skvortsov
2021-05-16 23:28:54 -04:00
committed by GitHub
parent 3635dbad19
commit 8468a05b87

View File

@@ -118,6 +118,7 @@ class SaveTagsToDatabase
$discussion->afterSave(function ($discussion) use ($newTagIds) {
$discussion->tags()->sync($newTagIds);
$discussion->unsetRelation('tags');
});
}
}