]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Diaspora.php
Merge pull request #8365 from nupplaphil/bug/mail_fix_text
[friendica.git] / src / Protocol / Diaspora.php
index 57b3a9d7983d3ad65af3ccd634510aa3a6977d5c..70965a72fd8e78121384bbe33eee592d6ba1b0e8 100644 (file)
@@ -2211,7 +2211,7 @@ class Diaspora
                        return false;
                }
 
-               $item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => false]);
+               $item = Item::selectFirst(['id'], ['guid' => $parent_guid, 'origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
                if (!DBA::isResult($item)) {
                        Logger::log('Item not found, no origin or private: '.$parent_guid);
                        return false;
@@ -2523,7 +2523,7 @@ class Diaspora
                // Do we already have this item?
                $fields = ['body', 'title', 'attach', 'tag', 'app', 'created', 'object-type', 'uri', 'guid',
                        'author-name', 'author-link', 'author-avatar'];
-               $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
+               $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => [Item::PUBLIC, Item::UNLISTED]];
                $item = Item::selectFirst($fields, $condition);
 
                if (DBA::isResult($item)) {
@@ -2567,7 +2567,7 @@ class Diaspora
                        if ($stored) {
                                $fields = ['body', 'title', 'attach', 'tag', 'app', 'created', 'object-type', 'uri', 'guid',
                                        'author-name', 'author-link', 'author-avatar'];
-                               $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => false];
+                               $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => [Item::PUBLIC, Item::UNLISTED]];
                                $item = Item::selectFirst($fields, $condition);
 
                                if (DBA::isResult($item)) {
@@ -2711,7 +2711,7 @@ class Diaspora
                $datarray["app"]  = $original_item["app"];
 
                $datarray["plink"] = self::plink($author, $guid);
-               $datarray["private"] = (($public == "false") ? 1 : 0);
+               $datarray["private"] = (($public == "false") ? Item::PRIVATE : Item::PUBLIC);
                $datarray["changed"] = $datarray["created"] = $datarray["edited"] = $created_at;
 
                $datarray["object-type"] = $original_item["object-type"];
@@ -2794,7 +2794,7 @@ class Diaspora
                                continue;
                        }
 
-                       Item::delete(['id' => $item['id']]);
+                       Item::markForDeletion(['id' => $item['id']]);
 
                        Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], Logger::DEBUG);
                }
@@ -2941,7 +2941,7 @@ class Diaspora
                }
 
                $datarray["plink"] = self::plink($author, $guid);
-               $datarray["private"] = (($public == "false") ? 1 : 0);
+               $datarray["private"] = (($public == "false") ? Item::PRIVATE : Item::PUBLIC);
                $datarray["changed"] = $datarray["created"] = $datarray["edited"] = $created_at;
 
                if (isset($address["address"])) {
@@ -3245,7 +3245,7 @@ class Diaspora
        private static function sendParticipation(array $contact, array $item)
        {
                // Don't send notifications for private postings
-               if ($item['private']) {
+               if ($item['private'] == Item::PRIVATE) {
                        return;
                }
 
@@ -3536,12 +3536,12 @@ class Diaspora
 
                $myaddr = self::myHandle($owner);
 
-               $public = ($item["private"] ? "false" : "true");
+               $public = ($item["private"] == Item::PRIVATE ? "false" : "true");
                $created = DateTimeFormat::utc($item['received'], DateTimeFormat::ATOM);
                $edited = DateTimeFormat::utc($item["edited"] ?? $item["created"], DateTimeFormat::ATOM);
 
                // Detect a share element and do a reshare
-               if (!$item['private'] && ($ret = self::isReshare($item["body"]))) {
+               if (($item['private'] != Item::PRIVATE) && ($ret = self::isReshare($item["body"]))) {
                        $message = ["author" => $myaddr,
                                        "guid" => $item["guid"],
                                        "created_at" => $created,