mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-21 22:11:26 +00:00
Merge pull request #3122 from idanoo/hashtag_unique_constraint_fix
Fix for firstOrCreate failing hashtags with case differences on name column
This commit is contained in:
commit
3ee699ba3f
1 changed files with 7 additions and 3 deletions
|
@ -107,9 +107,13 @@ class StatusEntityLexer implements ShouldQueue
|
||||||
}
|
}
|
||||||
DB::transaction(function () use ($status, $tag) {
|
DB::transaction(function () use ($status, $tag) {
|
||||||
$slug = str_slug($tag, '-', false);
|
$slug = str_slug($tag, '-', false);
|
||||||
$hashtag = Hashtag::firstOrCreate(
|
$hashtag = Hashtag::where('slug', $slug)->first();
|
||||||
['name' => $tag, 'slug' => $slug]
|
if (!$hashtag) {
|
||||||
);
|
$hashtag = Hashtag::create(
|
||||||
|
['name' => $tag, 'slug' => $slug]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
StatusHashtag::firstOrCreate(
|
StatusHashtag::firstOrCreate(
|
||||||
[
|
[
|
||||||
'status_id' => $status->id,
|
'status_id' => $status->id,
|
||||||
|
|
Loading…
Reference in a new issue