Merge branch '2024.09-rc' into port-2024.09-rc-into-develop

This commit is contained in:
Art4 2024-11-28 15:11:11 +00:00
commit 66d7ec5734
41 changed files with 21859 additions and 21110 deletions

View file

@ -125,13 +125,14 @@ class User
/**
* Block contact id for user id
*
* @param int $cid Either public contact id or user's contact id
* @param int $uid User ID
* @param boolean $blocked Is the contact blocked or unblocked?
* @param int $cid Either public contact id or user's contact id
* @param int $uid User ID
* @param boolean $blocked Is the contact blocked or unblocked?
* @param boolean $only_set Only set the block flag, don't execute any block transmission
* @return void
* @throws \Exception
*/
public static function setBlocked(int $cid, int $uid, bool $blocked)
public static function setBlocked(int $cid, int $uid, bool $blocked, bool $only_set = false)
{
$cdata = Contact::getPublicAndUserContactID($cid, $uid);
if (empty($cdata)) {
@ -139,10 +140,13 @@ class User
}
$contact = Contact::getById($cdata['public']);
if ($blocked) {
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Block', $cid, $uid);
} else {
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Unblock', $cid, $uid);
if (!$only_set) {
if ($blocked) {
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Block', $cid, $uid);
} else {
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Unblock', $cid, $uid);
}
}
if ($cdata['user'] != 0) {

View file

@ -29,6 +29,7 @@ class Conversation
const PARCEL_ATOM = 14;
const PARCEL_ATOM03 = 15;
const PARCEL_OPML = 16;
const PARCEL_JETSTREAM = 17; // @see https://github.com/bluesky-social/jetstream
const PARCEL_TWITTER = 67;
const PARCEL_CONNECTOR = 68;
const PARCEL_UNKNOWN = 255;

View file

@ -1472,6 +1472,12 @@ class Item
return false;
}
// We only have to apply restrictions if the post originates from our server or is federated.
// Every other time we can trust the remote system.
if (!in_array($item['network'], Protocol::FEDERATED) && !$item['origin']) {
return false;
}
if (($restrictions & self::CANT_REPLY) && ($item['verb'] == Activity::POST)) {
return true;
}
@ -1796,7 +1802,7 @@ class Item
}
}
if (($source_uid == 0) && (($item['private'] == self::PRIVATE) || !in_array($item['network'], Protocol::FEDERATED))) {
if (($source_uid == 0) && (($item['private'] == self::PRIVATE) || !in_array($item['network'], array_merge(Protocol::FEDERATED, [Protocol::BLUESKY])))) {
Logger::notice('Item is private or not from a federated network. It will not be stored for the user.', ['uri-id' => $uri_id, 'uid' => $uid, 'private' => $item['private'], 'network' => $item['network']]);
return 0;
}