diff options
author | Max Kostikov <max@kostikov.co> | 2021-04-17 23:46:40 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2021-04-17 23:46:40 +0200 |
commit | 200d3577fa32bb5107e0376dfd5ee9b3bc8b8721 (patch) | |
tree | 29be82bc3b5e67986d503ec2c37d05eb38b32db2 /Zotlabs/Lib/Activity.php | |
parent | b5620cb79443fcbf1820341bce05fadbb0b124be (diff) | |
parent | 8ab99747f55e60448d4468e99d97ae6c0fa566c0 (diff) | |
download | volse-hubzilla-200d3577fa32bb5107e0376dfd5ee9b3bc8b8721.tar.gz volse-hubzilla-200d3577fa32bb5107e0376dfd5ee9b3bc8b8721.tar.bz2 volse-hubzilla-200d3577fa32bb5107e0376dfd5ee9b3bc8b8721.zip |
Merge branch 'dev' of https://framagit.org/kostikov/core into dev
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 882bf4a1c..82e74fc83 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1094,18 +1094,7 @@ class Activity { 'height' => 300, 'width' => 300, ]; - $ret['url'] = [ - [ - 'type' => 'Link', - 'mediaType' => 'text/html', - 'href' => $p['xchan_url'] - ], - [ - 'type' => 'Link', - 'mediaType' => 'text/x-zot+json', - 'href' => $p['xchan_url'] - ] - ]; + $ret['url'] = $p['xchan_url']; $ret['publicKey'] = [ 'id' => $p['xchan_url'], @@ -1334,12 +1323,12 @@ class Activity { * */ - $person_obj = $act->actor; - - if ($act->type === 'Follow') { + if (in_array($act->type, [ 'Follow', 'Invite', 'Join'])) { $their_follow_id = $act->id; } + $person_obj = (($act->type == 'Invite') ? $act->obj : $act->actor); + if (is_array($person_obj)) { // store their xchan and hubloc @@ -1357,9 +1346,8 @@ class Activity { } } - $x = PermissionRoles::role_perms('social'); - $p = Permissions::FilledPerms($x['perms_connect']); - $their_perms = Permissions::serialise($p); + $x = \Zotlabs\Access\PermissionRoles::role_perms('social'); + $their_perms = \Zotlabs\Access\Permissions::FilledPerms($x['perms_connect']); if ($contact && $contact['abook_id']) { @@ -1368,6 +1356,8 @@ class Activity { switch ($act->type) { case 'Follow': + case 'Invite': + case 'Join': // A second Follow request, but we haven't approved the first one @@ -1433,8 +1423,8 @@ class Activity { } $ret = $r[0]; - $p = Permissions::connect_perms($channel['channel_id']); - $my_perms = Permissions::serialise($p['perms']); + $p = \Zotlabs\Access\Permissions::connect_perms($channel['channel_id']); + $my_perms = $p['perms']; $automatic = $p['automatic']; $closeness = get_pconfig($channel['channel_id'], 'system', 'new_abook_closeness', 80); @@ -1454,12 +1444,13 @@ class Activity { ] ); - if ($my_perms) - set_abconfig($channel['channel_id'], $ret['xchan_hash'], 'system', 'my_perms', $my_perms); - - if ($their_perms) - set_abconfig($channel['channel_id'], $ret['xchan_hash'], 'system', 'their_perms', $their_perms); + if($my_perms) + foreach($my_perms as $k => $v) + set_abconfig($channel['channel_id'],$ret['xchan_hash'],'my_perms',$k,$v); + if($their_perms) + foreach($their_perms as $k => $v) + set_abconfig($channel['channel_id'],$ret['xchan_hash'],'their_perms',$k,$v); if ($r) { logger("New ActivityPub follower for {$channel['channel_name']}"); |