1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00

Fix for firstOrCreate failing hashtags with case differences on name

This commit is contained in:
Daniel Mason 2022-01-05 19:41:32 +13:00
parent 5fc83beb2c
commit 9cc18eb82a

View file

@ -107,9 +107,13 @@ class StatusEntityLexer implements ShouldQueue
}
DB::transaction(function () use ($status, $tag) {
$slug = str_slug($tag, '-', false);
$hashtag = Hashtag::firstOrCreate(
['name' => $tag, 'slug' => $slug]
);
$hashtag = Hashtag::where('slug', $slug)->first();
if (!$hashtag) {
$hashtag = Hashtag::create(
['name' => $tag, 'slug' => $slug]
);
}
StatusHashtag::firstOrCreate(
[
'status_id' => $status->id,