]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Check the edit date before storing history
[friendica.git] / src / Model / Item.php
index d57700c33d077712af750baefab62833916df5e6..a1cccb25444a32e871a61862831f0b0ca8b0e8a1 100644 (file)
@@ -725,7 +725,7 @@ class Item
                return GRAVITY_UNKNOWN;   // Should not happen
        }
 
-       public static function insert(array $item, bool $notify = false, bool $post_local = true)
+       public static function insert(array $item, int $notify = 0, bool $post_local = true)
        {
                $orig_item = $item;
 
@@ -739,7 +739,7 @@ class Item
                        $item['protocol'] = Conversation::PARCEL_DIRECT;
                        $item['direction'] = Conversation::PUSH;
 
-                       if (in_array($notify, PRIORITIES)) {
+                       if (is_int($notify) && in_array($notify, PRIORITIES)) {
                                $priority = $notify;
                        }
                } else {
@@ -1442,7 +1442,7 @@ class Item
                        return 0;
                }
 
-               if ((($item['gravity'] == GRAVITY_COMMENT) || $is_reshare) && !Post::exists(['uri-id' => $item['thr-parent-id'], 'uid' => $uid])) {
+               if (($uri_id != $item['thr-parent-id']) && (($item['gravity'] == GRAVITY_COMMENT) || $is_reshare) && !Post::exists(['uri-id' => $item['thr-parent-id'], 'uid' => $uid])) {
                        // Fetch the origin user for the post
                        $origin_uid = self::GetOriginUidForUriId($item['thr-parent-id'], $uid);
                        if (is_null($origin_uid)) {
@@ -3200,6 +3200,12 @@ class Item
                                'orig_title' => DI::l10n()->t('View on separate page'),
                        ];
 
+                       if (!empty($plink) && ($item['private'] == self::PRIVATE)) {
+                               $author = ['uid' => 0, 'id' => $item['author-id'],
+                                       'network' => $item['author-network'], 'url' => $item['author-link']];
+                               $plink = Contact::magicLinkByContact($author, $plink);
+                       }
+
                        if (!empty($plink)) {
                                $ret['href'] = DI::baseUrl()->remove($plink);
                                $ret['title'] = DI::l10n()->t('Link to source');