]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Only public posts can be pinned
authorMichael <heluecht@pirati.ca>
Sat, 4 Jun 2022 06:11:32 +0000 (06:11 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 4 Jun 2022 06:11:32 +0000 (06:11 +0000)
database.sql
src/Model/Post/Collection.php
src/Object/Post.php
static/dbstructure.config.php
static/dbview.config.php

index f2f9a89e2e35ecaf500bce30b92ea37648ffb82d..f8d5432658564638a521d2b2201dab2ea3a36ddd 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2022.05-rc (Siberian Iris)
--- DB_UPDATE_VERSION 1464
+-- DB_UPDATE_VERSION 1465
 -- ------------------------------------------
 
 
@@ -2309,6 +2309,9 @@ CREATE VIEW `collection-view` AS SELECT
        `post`.`received` AS `received`,
        `post`.`created` AS `created`,
        `post-thread`.`commented` AS `commented`,
+       `post`.`private` AS `private`,
+       `post`.`visible` AS `visible`,
+       `post`.`deleted` AS `deleted`,
        `post`.`thr-parent-id` AS `thr-parent-id`,
        `post`.`author-id` AS `author-id`,
        `post`.`gravity` AS `gravity`
index 34b5dc6dee7a2ae83b3e22075fbb0833083b5043..363761d477a08831bd517a88bf40195fb258ad5a 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\Database\DBA;
 use BadMethodCallException;
 use Friendica\Database\Database;
 use Friendica\DI;
+use Friendica\Model\Item;
 use Friendica\Protocol\ActivityPub;
 
 class Collection
@@ -81,6 +82,6 @@ class Collection
         */
        public static function selectToArrayForContact(int $cid, int $type = self::FEATURED, array $fields = []) 
        {
-               return DBA::selectToArray('collection-view', $fields, ['cid' => $cid, 'type' => $type]);
+               return DBA::selectToArray('collection-view', $fields, ['cid' => $cid, 'private' => [Item::PUBLIC, Item::UNLISTED], 'deleted' => false, 'type' => $type]);
        }
 }
index 3f4b2760b59527a23cef9c76f508932fee0f82b3..fec3b3f2b3db7752015a74e0f7a4c47cde37a3dc 100644 (file)
@@ -342,7 +342,7 @@ class Post
                                ];
 
                                if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
-                                       if ($origin) {
+                                       if ($origin && in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
                                                $ispinned = ($item['featured'] ? 'pinned' : 'unpinned');
 
                                                $pin = [
index bf85bb56c793c62020fbe5f13585efad0d60df1e..ab25d934ab9f89130a88e02fbd666c8135926e3d 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1464);
+       define('DB_UPDATE_VERSION', 1465);
 }
 
 return [
index 30e17baf81abf82a8bba95c6d6f7626858fdf712..68217118ccaa34e310e6ebfa52c7c70f12655938 100644 (file)
                        "received" => ["post", "received"],
                        "created" => ["post", "created"],
                        "commented" => ["post-thread", "commented"],
+                       "private" => ["post", "private"],
+                       "visible" => ["post", "visible"],
+                       "deleted" => ["post", "deleted"],
                        "thr-parent-id" => ["post", "thr-parent-id"],
                        "author-id" => ["post", "author-id"],
                        "gravity" => ["post", "gravity"],