Merge pull request #11597 from annando/pinned-private

Fix: Only public posts can be pinned
This commit is contained in:
Tobias Diekershoff 2022-06-04 08:33:38 +02:00 committed by GitHub
commit 4a5d230aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 4 deletions

View 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`

View 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]);
}
}

View 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 = [

View 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 [

View file

@ -677,6 +677,9 @@
"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"],