Merge pull request #7894 from annando/mutuals-followers
Group selection: Respect "pubmail" and ignore atchived or blocked contacts
This commit is contained in:
commit
75d31341c2
1 changed files with 21 additions and 2 deletions
|
@ -328,13 +328,28 @@ class Group extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
|
$pubmail = false;
|
||||||
|
$networks = Protocol::SUPPORT_PRIVATE;
|
||||||
|
|
||||||
|
$mailacct = DBA::selectFirst('mailacct', ['pubmail'], ['`uid` = ? AND `server` != ""', $uid]);
|
||||||
|
if (DBA::isResult($mailacct)) {
|
||||||
|
$pubmail = $mailacct['pubmail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$pubmail) {
|
||||||
|
$networks = array_diff($networks, [Protocol::MAIL]);
|
||||||
|
}
|
||||||
|
|
||||||
$key = array_search(self::FOLLOWERS, $group_ids);
|
$key = array_search(self::FOLLOWERS, $group_ids);
|
||||||
if ($key !== false) {
|
if ($key !== false) {
|
||||||
$followers = Contact::selectToArray(['id'], [
|
$followers = Contact::selectToArray(['id'], [
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
'rel' => [Contact::FOLLOWER, Contact::FRIEND],
|
'rel' => [Contact::FOLLOWER, Contact::FRIEND],
|
||||||
'network' => Protocol::SUPPORT_PRIVATE,
|
'network' => $networks,
|
||||||
|
'contact-type' => [Contact::TYPE_UNKNOWN, Contact::TYPE_PERSON],
|
||||||
|
'archive' => false,
|
||||||
|
'pending' => false,
|
||||||
|
'blocked' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($followers as $follower) {
|
foreach ($followers as $follower) {
|
||||||
|
@ -349,7 +364,11 @@ class Group extends BaseObject
|
||||||
$mutuals = Contact::selectToArray(['id'], [
|
$mutuals = Contact::selectToArray(['id'], [
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
'rel' => [Contact::FRIEND],
|
'rel' => [Contact::FRIEND],
|
||||||
'network' => Protocol::SUPPORT_PRIVATE,
|
'network' => $networks,
|
||||||
|
'contact-type' => [Contact::TYPE_UNKNOWN, Contact::TYPE_PERSON],
|
||||||
|
'archive' => false,
|
||||||
|
'pending' => false,
|
||||||
|
'blocked' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($mutuals as $mutual) {
|
foreach ($mutuals as $mutual) {
|
||||||
|
|
Loading…
Reference in a new issue