diff options
-rw-r--r-- | Zotlabs/Lib/Activity.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index fd4dc4286..82e74fc83 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1323,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 @@ -1346,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']) { @@ -1357,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 @@ -1422,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); @@ -1443,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']}"); |