Add user meta-groups for followers and mutual contacts

- Both Group::expand and Item::enumeratePermissions now have a user id parameter to expand meta-groups
This commit is contained in:
Hypolite Petovan 2019-07-14 21:48:35 -04:00
commit 0579252362
7 changed files with 89 additions and 31 deletions

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Model\Group;
use Friendica\Model\Item;
function lockview_content(App $a)
@ -67,6 +68,19 @@ function lockview_content(App $a)
$l = [];
if (count($allowed_groups)) {
$key = array_search(Group::FOLLOWERS, $allowed_groups);
if ($key !== false) {
$l[] = '<b>' . L10n::t('Followers') . '</b>';
unset($allowed_groups[$key]);
}
$key = array_search(Group::MUTUALS, $allowed_groups);
if ($key !== false) {
$l[] = '<b>' . L10n::t('Mutuals') . '</b>';
unset($allowed_groups[$key]);
}
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
DBA::escape(implode(', ', $allowed_groups))
);
@ -89,6 +103,18 @@ function lockview_content(App $a)
}
if (count($deny_groups)) {
$key = array_search(Group::FOLLOWERS, $deny_groups);
if ($key !== false) {
$l[] = '<b><strike>' . L10n::t('Followers') . '</strike></b>';
unset($deny_groups[$key]);
}
$key = array_search(Group::MUTUALS, $deny_groups);
if ($key !== false) {
$l[] = '<b><strike>' . L10n::t('Mutuals') . '</strike></b>';
unset($deny_groups[$key]);
}
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
DBA::escape(implode(', ', $deny_groups))
);

View file

@ -643,7 +643,7 @@ function networkThreadedView(App $a, $update, $parent)
// NOTREACHED
}
$contacts = Group::expand([$gid]);
$contacts = Group::expand(local_user(), [$gid]);
if ((is_array($contacts)) && count($contacts)) {
$contact_str_self = '';