mirror of
https://github.com/friendica/friendica
synced 2025-04-23 07:10:14 +00:00
Issue 13812: Public groups with manual request approval
This commit is contained in:
parent
02d8cc2f71
commit
69fc2c04e4
18 changed files with 179 additions and 157 deletions
|
@ -51,7 +51,7 @@ class Whoami extends BaseApi
|
|||
$data['name'] = $owner['name'];
|
||||
$data['preferredUsername'] = $owner['nick'];
|
||||
$data['alsoKnownAs'] = [];
|
||||
$data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
|
||||
$data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP, User::PAGE_FLAGS_COMM_MAN]);
|
||||
$data['discoverable'] = (bool)$owner['net-publish'];
|
||||
$data['tag'] = [];
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ class UpdateCredentials extends BaseApi
|
|||
}
|
||||
|
||||
if ($user['account-type'] == Contact::TYPE_COMMUNITY) {
|
||||
// @todo Support for PAGE_FLAGS_COMM_MAN
|
||||
$user['page-flags'] = $request['locked'] ? User::PAGE_FLAGS_PRVGROUP : User::PAGE_FLAGS_COMMUNITY;
|
||||
} elseif ($user['account-type'] == Contact::TYPE_PERSON) {
|
||||
if ($request['locked']) {
|
||||
|
|
|
@ -53,7 +53,7 @@ class HCard extends BaseModule
|
|||
|
||||
$page = DI::page();
|
||||
|
||||
if (!empty($profile['page-flags']) && ($profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) {
|
||||
if (!empty($profile['page-flags']) && in_array($profile['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN])) {
|
||||
$page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
|
||||
}
|
||||
if (!empty($profile['openidserver'])) {
|
||||
|
|
|
@ -119,6 +119,7 @@ abstract class BaseUsers extends BaseModeration
|
|||
User::PAGE_FLAGS_NORMAL => $this->t('Normal Account Page'),
|
||||
User::PAGE_FLAGS_SOAPBOX => $this->t('Soapbox Page'),
|
||||
User::PAGE_FLAGS_COMMUNITY => $this->t('Public Group'),
|
||||
User::PAGE_FLAGS_COMM_MAN => $this->t('Public Group - Restricted'),
|
||||
User::PAGE_FLAGS_FREELOVE => $this->t('Automatic Friend Page'),
|
||||
User::PAGE_FLAGS_PRVGROUP => $this->t('Private Group')
|
||||
];
|
||||
|
|
|
@ -191,7 +191,7 @@ class Ping extends BaseModule
|
|||
if (!$this->notify->shouldShowOnDesktop($notification)) {
|
||||
return null;
|
||||
}
|
||||
if (($notification->type == Post\UserNotification::TYPE_NONE) && in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP])) {
|
||||
if (($notification->type == Post\UserNotification::TYPE_NONE) && in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP, User::PAGE_FLAGS_COMM_MAN])) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -144,7 +144,7 @@ class Conversations extends BaseProfile
|
|||
|
||||
$o .= Widget::commonFriendsVisitor($profile['uid'], $profile['nickname']);
|
||||
|
||||
$commpage = $profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
||||
$commpage = in_array($profile['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN]);
|
||||
$commvisitor = $commpage && $remote_contact;
|
||||
|
||||
$this->page['aside'] .= Widget::postedByYear($this->baseUrl . '/profile/' . $profile['nickname'] . '/conversations', $profile['profile_uid'] ?? 0, true);
|
||||
|
|
|
@ -122,7 +122,7 @@ class Profile extends BaseProfile
|
|||
$this->baseUrl->redirect('profile/' . $profile['nickname'] . '/restricted');
|
||||
}
|
||||
|
||||
if (!empty($profile['page-flags']) && $profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
if (!empty($profile['page-flags']) && in_array($profile['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN])) {
|
||||
$this->page['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ class Profile extends BaseProfile
|
|||
{
|
||||
$htmlhead = "\n";
|
||||
|
||||
if (!empty($profile['page-flags']) && $profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
if (!empty($profile['page-flags']) && in_array($profile['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN])) {
|
||||
$htmlhead .= '<meta name="friendica.community" content="true" />' . "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ class Account extends BaseSettings
|
|||
$page_flags = User::PAGE_FLAGS_SOAPBOX;
|
||||
} elseif ($account_type == User::ACCOUNT_TYPE_NEWS && $page_flags != User::PAGE_FLAGS_SOAPBOX) {
|
||||
$page_flags = User::PAGE_FLAGS_SOAPBOX;
|
||||
} elseif ($account_type == User::ACCOUNT_TYPE_COMMUNITY && !in_array($page_flags, [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
|
||||
} elseif ($account_type == User::ACCOUNT_TYPE_COMMUNITY && !in_array($page_flags, [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP, User::PAGE_FLAGS_COMM_MAN])) {
|
||||
$page_flags = User::PAGE_FLAGS_COMMUNITY;
|
||||
} elseif ($account_type == User::ACCOUNT_TYPE_RELAY && $page_flags != User::PAGE_FLAGS_SOAPBOX) {
|
||||
$page_flags = User::PAGE_FLAGS_SOAPBOX;
|
||||
|
@ -419,7 +419,7 @@ class Account extends BaseSettings
|
|||
// Set the account type to "Community" when the page is a community page but the account type doesn't fit
|
||||
// This is only happening on the first visit after the update
|
||||
if (
|
||||
in_array($user['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])
|
||||
in_array($user['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP, User::PAGE_FLAGS_COMM_MAN])
|
||||
&& $user['account-type'] != User::ACCOUNT_TYPE_COMMUNITY
|
||||
) {
|
||||
$user['account-type'] = User::ACCOUNT_TYPE_COMMUNITY;
|
||||
|
@ -498,6 +498,13 @@ class Account extends BaseSettings
|
|||
DI::l10n()->t('Automatically approves all contact requests.'),
|
||||
$user['page-flags'] == User::PAGE_FLAGS_COMMUNITY
|
||||
],
|
||||
'$page_community_manually' => [
|
||||
'page-flags',
|
||||
DI::l10n()->t('Public Group - Restricted'),
|
||||
User::PAGE_FLAGS_COMM_MAN,
|
||||
DI::l10n()->t('Contact requests have to be manually approved.'),
|
||||
$user['page-flags'] == User::PAGE_FLAGS_COMM_MAN
|
||||
],
|
||||
'$page_freelove' => [
|
||||
'page-flags',
|
||||
DI::l10n()->t('Automatic Friend Page'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue