Improved block behaviour

This commit is contained in:
Michael 2024-10-20 07:50:08 +00:00
parent 7e84699bdd
commit d867d73a23
18 changed files with 309 additions and 128 deletions

View file

@ -1590,11 +1590,15 @@ class Contact
*/
public static function getPostsFromId(int $cid, int $uid, bool $only_media = false, string $last_created = null): string
{
$contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
$contact = DBA::selectFirst('contact', ['contact-type', 'network', 'name', 'nick'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
return '';
}
if (Contact\User::isIsBlocked($cid, $uid)) {
return DI::l10n()->t('%s has blocked you', $contact['name'] ?: $contact['nick']);
}
if (empty($contact["network"]) || in_array($contact["network"], Protocol::FEDERATED)) {
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))", $uid];
} else {
@ -1658,11 +1662,15 @@ class Contact
*/
public static function getThreadsFromId(int $cid, int $uid, int $update = 0, int $parent = 0, string $last_created = ''): string
{
$contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
$contact = DBA::selectFirst('contact', ['contact-type', 'network', 'name', 'nick'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
return '';
}
if (Contact\User::isIsBlocked($cid, $uid)) {
return DI::l10n()->t('%s has blocked you', $contact['name'] ?: $contact['nick']);
}
if (empty($contact["network"]) || in_array($contact["network"], Protocol::FEDERATED)) {
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))", $uid];
} else {