]> git.mxchange.org Git - friendica.git/commitdiff
Issue 11440: Hashtags are now generated again
authorMichael <heluecht@pirati.ca>
Fri, 6 May 2022 17:03:51 +0000 (17:03 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 6 May 2022 17:03:51 +0000 (17:03 +0000)
src/Model/Tag.php

index 0ea19f55d9e11f5e8bc0f11585fd5f287e6480bf..b1c9822191b82777f6de794078b81ed477b1f855 100644 (file)
@@ -224,15 +224,18 @@ class Tag
        {
                $fields = ['name' => substr($name, 0, 96), 'url' => $url];
 
-               if (!empty($type)) {
-                       $fields['type'] = $type;
-               }
-
-               $tag = DBA::selectFirst('tag', ['id'], $fields);
+               $tag = DBA::selectFirst('tag', ['id', 'type'], $fields);
                if (DBA::isResult($tag)) {
+                       if (empty($tag['type']) && !empty($type)) {
+                               DBA::update('tag', ['type' => $type], $fields);
+                       }
                        return $tag['id'];
                }
 
+               if (!empty($type)) {
+                       $fields['type'] = $type;
+               }
+
                DBA::insert('tag', $fields, Database::INSERT_IGNORE);
                $tid = DBA::lastInsertId();
                if (!empty($tid)) {