Merge pull request #11597 from annando/pinned-private
Fix: Only public posts can be pinned
This commit is contained in:
commit
4a5d230aad
5 changed files with 11 additions and 4 deletions
|
@ -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`
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1464);
|
||||
define('DB_UPDATE_VERSION', 1465);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -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"],
|
||||
|
|
Loading…
Reference in a new issue