Merge pull request #11253 from annando/forum3
More rework to make private communities working
This commit is contained in:
commit
c03ff7833b
|
@ -240,7 +240,6 @@ function settings_post(App $a)
|
||||||
$allow_location = ((!empty($_POST['allow_location']) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
|
$allow_location = ((!empty($_POST['allow_location']) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
|
||||||
$publish = ((!empty($_POST['profile_in_directory']) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
|
$publish = ((!empty($_POST['profile_in_directory']) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
|
||||||
$net_publish = ((!empty($_POST['profile_in_netdirectory']) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
|
$net_publish = ((!empty($_POST['profile_in_netdirectory']) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
|
||||||
$old_visibility = ((!empty($_POST['visibility']) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
|
|
||||||
$account_type = ((!empty($_POST['account-type']) && (intval($_POST['account-type']))) ? intval($_POST['account-type']) : 0);
|
$account_type = ((!empty($_POST['account-type']) && (intval($_POST['account-type']))) ? intval($_POST['account-type']) : 0);
|
||||||
$page_flags = ((!empty($_POST['page-flags']) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
|
$page_flags = ((!empty($_POST['page-flags']) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
|
||||||
$blockwall = ((!empty($_POST['blockwall']) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
|
$blockwall = ((!empty($_POST['blockwall']) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
|
||||||
|
@ -362,16 +361,21 @@ function settings_post(App $a)
|
||||||
DI::pConfig()->set(local_user(), 'system', 'unlisted', $unlisted);
|
DI::pConfig()->set(local_user(), 'system', 'unlisted', $unlisted);
|
||||||
DI::pConfig()->set(local_user(), 'system', 'accessible-photos', $accessiblephotos);
|
DI::pConfig()->set(local_user(), 'system', 'accessible-photos', $accessiblephotos);
|
||||||
|
|
||||||
|
if ($account_type == User::ACCOUNT_TYPE_COMMUNITY) {
|
||||||
|
$str_group_allow = '';
|
||||||
|
$str_contact_allow = '';
|
||||||
|
$str_group_deny = '';
|
||||||
|
$str_contact_deny = '';
|
||||||
|
|
||||||
|
DI::pConfig()->set(local_user(), 'system', 'unlisted', true);
|
||||||
|
|
||||||
|
$blockwall = true;
|
||||||
|
$blocktags = true;
|
||||||
|
$hide_friends = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($page_flags == User::PAGE_FLAGS_PRVGROUP) {
|
if ($page_flags == User::PAGE_FLAGS_PRVGROUP) {
|
||||||
$hidewall = 1;
|
$str_group_allow = '<' . Group::FOLLOWERS . '>';
|
||||||
if (!$str_contact_allow && !$str_group_allow && !$str_contact_deny && !$str_group_deny) {
|
|
||||||
if ($def_gid) {
|
|
||||||
info(DI::l10n()->t('Private forum has no privacy permissions. Using default privacy group.'));
|
|
||||||
$str_group_allow = '<' . $def_gid . '>';
|
|
||||||
} else {
|
|
||||||
notice(DI::l10n()->t('Private forum has no privacy permissions and no default privacy group.'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = ['username' => $username, 'email' => $email, 'timezone' => $timezone,
|
$fields = ['username' => $username, 'email' => $email, 'timezone' => $timezone,
|
||||||
|
@ -767,7 +771,7 @@ function settings_content(App $a)
|
||||||
'$allowloc' => ['allow_location', DI::l10n()->t('Use Browser Location:'), ($user['allow_location'] == 1), ''],
|
'$allowloc' => ['allow_location', DI::l10n()->t('Use Browser Location:'), ($user['allow_location'] == 1), ''],
|
||||||
|
|
||||||
'$h_prv' => DI::l10n()->t('Security and Privacy Settings'),
|
'$h_prv' => DI::l10n()->t('Security and Privacy Settings'),
|
||||||
'$visibility' => $profile['net-publish'],
|
'$is_community' => ($user['account-type'] == User::ACCOUNT_TYPE_COMMUNITY),
|
||||||
'$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")],
|
'$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")],
|
||||||
'$profile_in_dir' => $profile_in_dir,
|
'$profile_in_dir' => $profile_in_dir,
|
||||||
'$profile_in_net_dir' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc],
|
'$profile_in_net_dir' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc],
|
||||||
|
|
|
@ -556,7 +556,7 @@ class Group
|
||||||
*
|
*
|
||||||
* @param integer $id Contact ID
|
* @param integer $id Contact ID
|
||||||
*/
|
*/
|
||||||
public static function getMembersForForum(int $id)
|
public static function updateMembersForForum(int $id)
|
||||||
{
|
{
|
||||||
Logger::info('Update forum members', ['id' => $id]);
|
Logger::info('Update forum members', ['id' => $id]);
|
||||||
|
|
||||||
|
|
|
@ -1236,8 +1236,11 @@ class Item
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self_contact = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
|
||||||
|
$self = !empty($self_contact) ? $self_contact['id'] : 0;
|
||||||
|
|
||||||
$cid = Contact::getIdForURL($author['url'], $item['uid']);
|
$cid = Contact::getIdForURL($author['url'], $item['uid']);
|
||||||
if (empty($cid) || !Contact::isSharing($cid, $item['uid'])) {
|
if (empty($cid) || (!Contact::isSharing($cid, $item['uid']) && ($cid != $self))) {
|
||||||
Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
|
Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1471,7 +1474,7 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the post belongs to a a forum then all forum users are allowed to access it
|
// When the post belongs to a a forum then all forum users are allowed to access it
|
||||||
foreach (Tag::getByURIId($uriid, [Tag::EXCLUSIVE_MENTION]) as $tag) {
|
foreach (Tag::getByURIId($uriid, [Tag::MENTION, Tag::EXCLUSIVE_MENTION]) as $tag) {
|
||||||
if (DBA::exists('contact', ['uid' => $uid, 'nurl' => Strings::normaliseLink($tag['url']), 'contact-type' => Contact::TYPE_COMMUNITY])) {
|
if (DBA::exists('contact', ['uid' => $uid, 'nurl' => Strings::normaliseLink($tag['url']), 'contact-type' => Contact::TYPE_COMMUNITY])) {
|
||||||
$target_uid = User::getIdForURL($tag['url']);
|
$target_uid = User::getIdForURL($tag['url']);
|
||||||
if (!empty($target_uid)) {
|
if (!empty($target_uid)) {
|
||||||
|
@ -1945,7 +1948,7 @@ class Item
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
$owner = User::getOwnerDataById($uid);
|
||||||
if (!DBA::isResult($owner)) {
|
if (!DBA::isResult($owner)) {
|
||||||
Logger::warning('User not found, quitting.', ['uid' => $uid]);
|
Logger::warning('User not found, quitting here.', ['uid' => $uid]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1954,17 +1957,13 @@ class Item
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]);
|
$item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'origin' => false]);
|
||||||
if (!DBA::isResult($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
Logger::warning('Post not found, quitting.', ['id' => $item_id]);
|
Logger::debug('Post is an activity or origin or not found at all, quitting here.', ['id' => $item_id]);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($item['wall'] || $item['origin'] || ($item['gravity'] != GRAVITY_PARENT)) {
|
|
||||||
Logger::debug('Wall item, origin item or no parent post, quitting here.', ['wall' => $item['wall'], 'origin' => $item['origin'], 'gravity' => $item['gravity'], 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($item['gravity'] == GRAVITY_PARENT) {
|
||||||
$tags = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]);
|
$tags = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]);
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (Strings::compareLink($owner['url'], $tag['url'])) {
|
if (Strings::compareLink($owner['url'], $tag['url'])) {
|
||||||
|
@ -1973,19 +1972,6 @@ class Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check can most likely be removed since we always are having the tags
|
|
||||||
if (!$mention) {
|
|
||||||
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER);
|
|
||||||
if ($cnt) {
|
|
||||||
foreach ($matches as $mtch) {
|
|
||||||
if (Strings::compareLink($owner['url'], $mtch[1])) {
|
|
||||||
$mention = true;
|
|
||||||
Logger::notice('Mention found in body.', ['mention' => $mtch[2], 'uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$mention) {
|
if (!$mention) {
|
||||||
Logger::info('Top-level post without mention is deleted.', ['uri' => $item['uri'], $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
Logger::info('Top-level post without mention is deleted.', ['uri' => $item['uri'], $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
||||||
Post\User::delete(['uri-id' => $item['uri-id'], 'uid' => $item['uid']]);
|
Post\User::delete(['uri-id' => $item['uri-id'], 'uid' => $item['uid']]);
|
||||||
|
@ -1995,14 +1981,26 @@ class Item
|
||||||
$arr = ['item' => $item, 'user' => $owner];
|
$arr = ['item' => $item, 'user' => $owner];
|
||||||
|
|
||||||
Hook::callAll('tagged', $arr);
|
Hook::callAll('tagged', $arr);
|
||||||
|
} else {
|
||||||
|
$tags = Tag::getByURIId($item['parent-uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]);
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
if (Strings::compareLink($owner['url'], $tag['url'])) {
|
||||||
|
$mention = true;
|
||||||
|
Logger::info('Mention found in parent tag.', ['url' => $tag['url'], 'uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$mention) {
|
||||||
|
Logger::debug('No mentions found in parent, quitting here.', ['id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Logger::info('Community post will be distributed', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
Logger::info('Community post will be distributed', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
|
||||||
|
|
||||||
if ($owner['page-flags'] == User::PAGE_FLAGS_PRVGROUP) {
|
if ($owner['page-flags'] == User::PAGE_FLAGS_PRVGROUP) {
|
||||||
Group::getMembersForForum($owner['id']);
|
$allow_cid = '';
|
||||||
|
$allow_gid = '<' . Group::FOLLOWERS . '>';
|
||||||
$allow_cid = '<' . $owner['id'] . '>';
|
|
||||||
$allow_gid = '<' . Group::getIdForForum($owner['id']) . '>';
|
|
||||||
$deny_cid = '';
|
$deny_cid = '';
|
||||||
$deny_gid = '';
|
$deny_gid = '';
|
||||||
self::performActivity($item['id'], 'announce', $uid, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
|
self::performActivity($item['id'], 'announce', $uid, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
|
||||||
|
@ -3215,31 +3213,21 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the given item array a post that is sent as starting post to a forum?
|
* Does the given uri-id belongs to a post that is sent as starting post to a forum?
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param int $uri_id
|
||||||
* @param array $owner
|
|
||||||
*
|
*
|
||||||
* @return boolean "true" when it is a forum post
|
* @return boolean "true" when it is a forum post
|
||||||
*/
|
*/
|
||||||
public static function isForumPost(array $item, array $owner = [])
|
public static function isForumPost(int $uri_id)
|
||||||
{
|
{
|
||||||
if (empty($owner)) {
|
foreach (Tag::getByURIId($uri_id, [Tag::EXCLUSIVE_MENTION]) as $tag) {
|
||||||
$owner = User::getOwnerDataById($item['uid']);
|
if (DBA::exists('contact', ['uid' => 0, 'nurl' => Strings::normaliseLink($tag['url']), 'contact-type' => Contact::TYPE_COMMUNITY])) {
|
||||||
if (empty($owner)) {
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (($item['author-id'] == $item['owner-id']) ||
|
|
||||||
($owner['id'] == $item['contact-id']) ||
|
|
||||||
($item['uri-id'] != $item['parent-uri-id']) ||
|
|
||||||
$item['origin']) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Contact::isForum($item['contact-id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search item id for given URI or plink
|
* Search item id for given URI or plink
|
||||||
|
|
|
@ -182,6 +182,11 @@ class UserNotification
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$author = Contact::getById($item['author-id'], ['contact-type']);
|
||||||
|
if (empty($author)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$notification_type = self::TYPE_NONE;
|
$notification_type = self::TYPE_NONE;
|
||||||
|
|
||||||
if (self::checkShared($item, $uid)) {
|
if (self::checkShared($item, $uid)) {
|
||||||
|
@ -232,7 +237,7 @@ class UserNotification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::checkDirectCommentedThread($item, $contacts)) {
|
if (($contact['contact-type'] != Contact::TYPE_COMMUNITY) && self::checkDirectCommentedThread($item, $contacts)) {
|
||||||
$notification_type = $notification_type | self::TYPE_DIRECT_THREAD_COMMENT;
|
$notification_type = $notification_type | self::TYPE_DIRECT_THREAD_COMMENT;
|
||||||
if (!$notified) {
|
if (!$notified) {
|
||||||
self::insertNotificationByItem(self::TYPE_DIRECT_THREAD_COMMENT, $uid, $item);
|
self::insertNotificationByItem(self::TYPE_DIRECT_THREAD_COMMENT, $uid, $item);
|
||||||
|
|
|
@ -81,6 +81,7 @@ class Objects extends BaseModule
|
||||||
$requester = HTTPSignature::getSigner('', $_SERVER);
|
$requester = HTTPSignature::getSigner('', $_SERVER);
|
||||||
if (!empty($requester)) {
|
if (!empty($requester)) {
|
||||||
$receivers = Item::enumeratePermissions($item, false);
|
$receivers = Item::enumeratePermissions($item, false);
|
||||||
|
$receivers[] = $item['contact-id'];
|
||||||
|
|
||||||
$validated = in_array(Contact::getIdForURL($requester, $item['uid']), $receivers);
|
$validated = in_array(Contact::getIdForURL($requester, $item['uid']), $receivers);
|
||||||
if (!$validated) {
|
if (!$validated) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
|
||||||
{
|
{
|
||||||
$message = [];
|
$message = [];
|
||||||
|
|
||||||
$causer = $author = Contact::getById($Notification->actorId, ['id', 'name', 'url', 'pending']);
|
$causer = $author = Contact::getById($Notification->actorId, ['id', 'name', 'url', 'contact-type', 'pending']);
|
||||||
if (empty($causer)) {
|
if (empty($causer)) {
|
||||||
$this->logger->info('Causer not found', ['contact' => $Notification->actorId]);
|
$this->logger->info('Causer not found', ['contact' => $Notification->actorId]);
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -124,7 +124,7 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($Notification->type, [Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION, Post\UserNotification::TYPE_SHARED])) {
|
if (in_array($Notification->type, [Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION, Post\UserNotification::TYPE_SHARED])) {
|
||||||
$author = Contact::getById($item['author-id'], ['id', 'name', 'url']);
|
$author = Contact::getById($item['author-id'], ['id', 'name', 'url', 'contact-type']);
|
||||||
if (empty($author)) {
|
if (empty($author)) {
|
||||||
$this->logger->info('Author not found', ['author' => $item['author-id']]);
|
$this->logger->info('Author not found', ['author' => $item['author-id']]);
|
||||||
return $message;
|
return $message;
|
||||||
|
|
|
@ -667,6 +667,15 @@ class Receiver
|
||||||
$uid = $receiver['uid'];
|
$uid = $receiver['uid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When we haven't found any user yet, we just chose a user who most likely could have access to the content
|
||||||
|
if (empty($uid)) {
|
||||||
|
$contact = Contact::selectFirst(['uid'], ['nurl' => Strings::normaliseLink($actor), 'rel' => [Contact::SHARING, Contact::FRIEND]]);
|
||||||
|
if (!empty($contact['uid'])) {
|
||||||
|
$uid = $contact['uid'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $uid;
|
return $uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -512,25 +512,30 @@ class Transmitter
|
||||||
* @param array $item Item array
|
* @param array $item Item array
|
||||||
* @param boolean $blindcopy addressing via "bcc" or "cc"?
|
* @param boolean $blindcopy addressing via "bcc" or "cc"?
|
||||||
* @param integer $last_id Last item id for adding receivers
|
* @param integer $last_id Last item id for adding receivers
|
||||||
* @param boolean $forum_post "true" means that we are sending content to a forum
|
|
||||||
*
|
*
|
||||||
* @return array with permission data
|
* @return array with permission data
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
*/
|
*/
|
||||||
private static function createPermissionBlockForItem($item, $blindcopy, $last_id = 0, $forum_post = false)
|
private static function createPermissionBlockForItem($item, $blindcopy, $last_id = 0)
|
||||||
{
|
{
|
||||||
if ($last_id == 0) {
|
if ($last_id == 0) {
|
||||||
$last_id = $item['id'];
|
$last_id = $item['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$always_bcc = false;
|
$always_bcc = false;
|
||||||
|
$is_forum = false;
|
||||||
|
$follower = '';
|
||||||
|
|
||||||
// Check if we should always deliver our stuff via BCC
|
// Check if we should always deliver our stuff via BCC
|
||||||
if (!empty($item['uid'])) {
|
if (!empty($item['uid'])) {
|
||||||
$profile = User::getOwnerDataById($item['uid']);
|
$owner = User::getOwnerDataById($item['uid']);
|
||||||
if (!empty($profile)) {
|
if (!empty($owner)) {
|
||||||
$always_bcc = $profile['hide-friends'];
|
$always_bcc = $owner['hide-friends'];
|
||||||
|
$is_forum = ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY) && $owner['manually-approve'];
|
||||||
|
|
||||||
|
$profile = APContact::getByURL($owner['url'], false);
|
||||||
|
$follower = $profile['followers'] ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +618,9 @@ class Transmitter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$exclusive) {
|
if ($is_forum && !$exclusive && !empty($follower)) {
|
||||||
|
$data['cc'][] = $follower;
|
||||||
|
} elseif (!$exclusive) {
|
||||||
foreach ($receiver_list as $receiver) {
|
foreach ($receiver_list as $receiver) {
|
||||||
$contact = DBA::selectFirst('contact', ['url', 'hidden', 'network', 'protocol', 'gsid'], ['id' => $receiver, 'network' => Protocol::FEDERATED]);
|
$contact = DBA::selectFirst('contact', ['url', 'hidden', 'network', 'protocol', 'gsid'], ['id' => $receiver, 'network' => Protocol::FEDERATED]);
|
||||||
if (!DBA::isResult($contact) || !self::isAPContact($contact, $networks)) {
|
if (!DBA::isResult($contact) || !self::isAPContact($contact, $networks)) {
|
||||||
|
@ -652,9 +659,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
} elseif (!$exclusive) {
|
} elseif (!$exclusive) {
|
||||||
// Public thread parent post always are directed to the followers.
|
// Public thread parent post always are directed to the followers.
|
||||||
// This mustn't be done by posts that are directed to forum servers via the exclusive mention.
|
if ($item['private'] != Item::PRIVATE) {
|
||||||
// But possibly in that case we could add the "followers" collection of the forum to the message.
|
|
||||||
if (($item['private'] != Item::PRIVATE) && !$forum_post) {
|
|
||||||
$data['cc'][] = $actor_profile['followers'];
|
$data['cc'][] = $actor_profile['followers'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -824,14 +829,13 @@ class Transmitter
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
* @param boolean $personal fetch personal inboxes
|
* @param boolean $personal fetch personal inboxes
|
||||||
* @param integer $last_id Last item id for adding receivers
|
* @param integer $last_id Last item id for adding receivers
|
||||||
* @param boolean $forum_post "true" means that we are sending content to a forum
|
|
||||||
* @return array with inboxes
|
* @return array with inboxes
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
*/
|
*/
|
||||||
public static function fetchTargetInboxes($item, $uid, $personal = false, $last_id = 0, $forum_post = false)
|
public static function fetchTargetInboxes($item, $uid, $personal = false, $last_id = 0)
|
||||||
{
|
{
|
||||||
$permissions = self::createPermissionBlockForItem($item, true, $last_id, $forum_post);
|
$permissions = self::createPermissionBlockForItem($item, true, $last_id);
|
||||||
if (empty($permissions)) {
|
if (empty($permissions)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,13 +235,13 @@ class Notifier
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special treatment for forum posts
|
// Special treatment for forum posts
|
||||||
if (Item::isForumPost($target_item, $owner)) {
|
if (Item::isForumPost($target_item['uri-id'])) {
|
||||||
$relay_to_owner = true;
|
$relay_to_owner = true;
|
||||||
$direct_forum_delivery = true;
|
$direct_forum_delivery = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid that comments in a forum thread are sent to OStatus
|
// Avoid that comments in a forum thread are sent to OStatus
|
||||||
if (Item::isForumPost($parent, $owner)) {
|
if (Item::isForumPost($parent['uri-id'])) {
|
||||||
$direct_forum_delivery = true;
|
$direct_forum_delivery = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,6 +729,14 @@ class Notifier
|
||||||
|
|
||||||
$uid = $target_item['contact-uid'] ?: $target_item['uid'];
|
$uid = $target_item['contact-uid'] ?: $target_item['uid'];
|
||||||
|
|
||||||
|
// Update the locally stored follower list when we deliver to a forum
|
||||||
|
foreach (Tag::getByURIId($target_item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]) as $tag) {
|
||||||
|
$target_contact = Contact::getByURL(Strings::normaliseLink($tag['url']), null, [], $uid);
|
||||||
|
if (($target_contact['contact-type'] == Contact::TYPE_COMMUNITY) && $target_contact['manually-approve']) {
|
||||||
|
Group::updateMembersForForum($target_contact['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($target_item['origin']) {
|
if ($target_item['origin']) {
|
||||||
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid);
|
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid);
|
||||||
|
|
||||||
|
@ -738,9 +746,6 @@ class Notifier
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info('Origin item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . ' will be distributed.');
|
Logger::info('Origin item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . ' will be distributed.');
|
||||||
} elseif (Item::isForumPost($target_item, $owner)) {
|
|
||||||
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid, false, 0, true);
|
|
||||||
Logger::info('Forum item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . ' will be distributed.');
|
|
||||||
} elseif (!DBA::exists('conversation', ['item-uri' => $target_item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB])) {
|
} elseif (!DBA::exists('conversation', ['item-uri' => $target_item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB])) {
|
||||||
Logger::info('Remote item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.');
|
Logger::info('Remote item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.');
|
||||||
return ['count' => 0, 'contacts' => []];
|
return ['count' => 0, 'contacts' => []];
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,28 +39,28 @@
|
||||||
|
|
||||||
<h2 class="settings-heading"><a href="javascript:;">{{$h_prv}}</a></h2>
|
<h2 class="settings-heading"><a href="javascript:;">{{$h_prv}}</a></h2>
|
||||||
<div class="settings-content-block">
|
<div class="settings-content-block">
|
||||||
|
|
||||||
<input type="hidden" name="visibility" value="{{$visibility}}"/>
|
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$maxreq}}
|
{{include file="field_input.tpl" field=$maxreq}}
|
||||||
|
|
||||||
{{$profile_in_dir nofilter}}
|
{{$profile_in_dir nofilter}}
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$profile_in_net_dir}}
|
{{include file="field_checkbox.tpl" field=$profile_in_net_dir}}
|
||||||
{{include file="field_checkbox.tpl" field=$hide_friends}}
|
{{if not $is_community}}{{include file="field_checkbox.tpl" field=$hide_friends}}{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$hide_wall}}
|
{{include file="field_checkbox.tpl" field=$hide_wall}}
|
||||||
{{include file="field_checkbox.tpl" field=$unlisted}}
|
{{if not $is_community}}{{include file="field_checkbox.tpl" field=$unlisted}}{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$accessiblephotos}}
|
{{include file="field_checkbox.tpl" field=$accessiblephotos}}
|
||||||
|
{{if not $is_community}}
|
||||||
{{include file="field_checkbox.tpl" field=$blockwall}}
|
{{include file="field_checkbox.tpl" field=$blockwall}}
|
||||||
{{include file="field_checkbox.tpl" field=$blocktags}}
|
{{include file="field_checkbox.tpl" field=$blocktags}}
|
||||||
|
{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$unkmail}}
|
{{include file="field_checkbox.tpl" field=$unkmail}}
|
||||||
{{include file="field_input.tpl" field=$cntunkmail}}
|
{{include file="field_input.tpl" field=$cntunkmail}}
|
||||||
|
|
||||||
{{$group_select nofilter}}
|
{{$group_select nofilter}}
|
||||||
|
{{if not $is_community}}
|
||||||
<h3>{{$permissions}}</h3>
|
<h3>{{$permissions}}</h3>
|
||||||
|
|
||||||
{{$aclselect nofilter}}
|
{{$aclselect nofilter}}
|
||||||
|
{{/if}}
|
||||||
<div class="settings-submit-wrapper">
|
<div class="settings-submit-wrapper">
|
||||||
<input type="submit" name="submit" class="settings-submit" value="{{$submit}}"/>
|
<input type="submit" name="submit" class="settings-submit" value="{{$submit}}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -70,28 +70,29 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="privacy-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="privacy-settings">
|
<div id="privacy-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="privacy-settings">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
<input type="hidden" name="visibility" value="{{$visibility}}" />
|
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$maxreq}}
|
{{include file="field_input.tpl" field=$maxreq}}
|
||||||
|
|
||||||
{{$profile_in_dir nofilter}}
|
{{$profile_in_dir nofilter}}
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$profile_in_net_dir}}
|
{{include file="field_checkbox.tpl" field=$profile_in_net_dir}}
|
||||||
{{include file="field_checkbox.tpl" field=$hide_friends}}
|
{{if not $is_community}}{{include file="field_checkbox.tpl" field=$hide_friends}}{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$hide_wall}}
|
{{include file="field_checkbox.tpl" field=$hide_wall}}
|
||||||
{{include file="field_checkbox.tpl" field=$unlisted}}
|
{{if not $is_community}}{{include file="field_checkbox.tpl" field=$unlisted}}{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$accessiblephotos}}
|
{{include file="field_checkbox.tpl" field=$accessiblephotos}}
|
||||||
|
{{if not $is_community}}
|
||||||
{{include file="field_checkbox.tpl" field=$blockwall}}
|
{{include file="field_checkbox.tpl" field=$blockwall}}
|
||||||
{{include file="field_checkbox.tpl" field=$blocktags}}
|
{{include file="field_checkbox.tpl" field=$blocktags}}
|
||||||
|
{{/if}}
|
||||||
{{include file="field_checkbox.tpl" field=$unkmail}}
|
{{include file="field_checkbox.tpl" field=$unkmail}}
|
||||||
{{include file="field_input.tpl" field=$cntunkmail}}
|
{{include file="field_input.tpl" field=$cntunkmail}}
|
||||||
|
|
||||||
{{$group_select nofilter}}
|
{{$group_select nofilter}}
|
||||||
|
|
||||||
|
{{if not $is_community}}
|
||||||
<h3>{{$permissions}}</h3>
|
<h3>{{$permissions}}</h3>
|
||||||
|
|
||||||
{{$aclselect nofilter}}
|
{{$aclselect nofilter}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
|
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user