mirror of
https://github.com/friendica/friendica
synced 2025-04-23 18:30:11 +00:00
Merge pull request #14392 from annando/issue-14377
Disallow posting to restricted groups
This commit is contained in:
commit
f597d7aac7
3 changed files with 29 additions and 15 deletions
|
@ -86,7 +86,7 @@ class Conversations extends BaseModule
|
|||
throw new NotFoundException($this->t('Contact not found.'));
|
||||
}
|
||||
|
||||
$contact = Model\Contact::getById($pcid);
|
||||
$contact = Model\Contact::getAccountById($pcid);
|
||||
if (empty($contact)) {
|
||||
throw new NotFoundException($this->t('Contact not found.'));
|
||||
}
|
||||
|
@ -111,13 +111,15 @@ class Conversations extends BaseModule
|
|||
|
||||
Nav::setSelected('contact');
|
||||
|
||||
$options = [
|
||||
'lockstate' => ACL::getLockstateForUserId($this->userSession->getLocalUserId()) ? 'lock' : 'unlock',
|
||||
'acl' => ACL::getFullSelectorHTML($this->page, $this->userSession->getLocalUserId(), true, []),
|
||||
'bang' => '',
|
||||
'content' => ($contact['contact-type'] == ModelContact::TYPE_COMMUNITY ? '!' : '@') . ($contact['addr'] ?: $contact['url']),
|
||||
];
|
||||
$o = $this->conversation->statusEditor($options);
|
||||
if (!$contact['ap-posting-restricted']) {
|
||||
$options = [
|
||||
'lockstate' => ACL::getLockstateForUserId($this->userSession->getLocalUserId()) ? 'lock' : 'unlock',
|
||||
'acl' => ACL::getFullSelectorHTML($this->page, $this->userSession->getLocalUserId(), true, []),
|
||||
'bang' => '',
|
||||
'content' => ($contact['contact-type'] == ModelContact::TYPE_COMMUNITY ? '!' : '@') . ($contact['addr'] ?: $contact['url']),
|
||||
];
|
||||
$o = $this->conversation->statusEditor($options);
|
||||
}
|
||||
|
||||
$o .= Contact::getTabsHTML($contact, Contact::TAB_CONVERSATIONS);
|
||||
$o .= Model\Contact::getThreadsFromId($contact['id'], $this->userSession->getLocalUserId(), 0, 0, $request['last_created'] ?? '');
|
||||
|
|
|
@ -156,30 +156,30 @@ class Acl extends BaseModule
|
|||
switch ($type) {
|
||||
case self::TYPE_MENTION_CONTACT_CIRCLE:
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["NOT `self` AND NOT `blocked` AND `notify` != ? AND `network` != ?", '', Protocol::OSTATUS
|
||||
["NOT `self` AND NOT `blocked` AND `network` != ?", Protocol::OSTATUS
|
||||
]);
|
||||
break;
|
||||
|
||||
case self::TYPE_MENTION_CONTACT:
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["NOT `self` AND NOT `blocked` AND `notify` != ?", ''
|
||||
["NOT `self` AND NOT `blocked`",
|
||||
]);
|
||||
break;
|
||||
|
||||
case self::TYPE_MENTION_GROUP:
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["NOT `self` AND NOT `blocked` AND `notify` != ? AND `contact-type` = ?", '', Contact::TYPE_COMMUNITY
|
||||
["NOT `self` AND NOT `blocked` AND (NOT `ap-posting-restricted` OR `ap-posting-restricted` IS NULL) AND `contact-type` = ?", Contact::TYPE_COMMUNITY
|
||||
]);
|
||||
break;
|
||||
|
||||
case self::TYPE_PRIVATE_MESSAGE:
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["NOT `self` AND NOT `blocked` AND `notify` != ? AND `network` IN (?, ?, ?)", '', Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA
|
||||
["NOT `self` AND NOT `blocked` AND `network` IN (?, ?, ?)", Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA
|
||||
]);
|
||||
break;
|
||||
}
|
||||
|
||||
$contact_count = $this->database->count('contact', $condition);
|
||||
$contact_count = $this->database->count('account-user-view', $condition);
|
||||
|
||||
$resultTotal = $circle_count + $contact_count;
|
||||
|
||||
|
@ -220,7 +220,7 @@ class Acl extends BaseModule
|
|||
|
||||
$contacts = [];
|
||||
if ($type != self::TYPE_MENTION_CIRCLE) {
|
||||
$contacts = Contact::selectToArray([], $condition, ['order' => ['name']]);
|
||||
$contacts = Contact::selectAccountToArray([], $condition, ['order' => ['name']]);
|
||||
}
|
||||
|
||||
$groups = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue