diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-12-23 10:09:46 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-12-23 10:09:46 +0100 |
commit | 3b9b03cf86979b28e7fa249133176bed84b0105c (patch) | |
tree | 336dc8b8b9627e7f4a93e5c35fe3e98555274616 /include/follow.php | |
parent | 2e5a993f880d619aedf3693927e7b3e164fbfcc0 (diff) | |
parent | ef39c1e94b5149a3019d417d08dc7c16c8aef9c1 (diff) | |
download | volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.tar.gz volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.tar.bz2 volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.zip |
Merge branch '2.0RC'
Diffstat (limited to 'include/follow.php')
-rw-r--r-- | include/follow.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/include/follow.php b/include/follow.php index 5f63687f8..fa198e402 100644 --- a/include/follow.php +++ b/include/follow.php @@ -211,7 +211,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) return $result; } - $r = q("select abook_xchan, abook_instance from abook where abook_xchan = '%s' and abook_channel = %d limit 1", + $r = q("select abook_id, abook_xchan, abook_pending, abook_instance from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($xchan_hash), intval($uid) ); @@ -237,7 +237,28 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) $x = q("update abook set abook_instance = '%s' where abook_id = %d", dbesc($abook_instance), intval($r[0]['abook_id']) - ); + ); + + if(intval($r[0]['abook_pending'])) { + + $abook_my_perms = get_channel_default_perms($uid); + $role = get_pconfig($uid,'system','permissions_role'); + if($role) { + $x = \Zotlabs\Access\PermissionRoles::role_perms($role); + if($x['perms_connect']) { + $abook_my_perms = $x['perms_connect']; + } + } + + $filled_perms = \Zotlabs\Access\Permissions::FilledPerms($abook_my_perms); + foreach($filled_perms as $k => $v) { + set_abconfig($uid,$r[0]['abook_xchan'],'my_perms',$k,$v); + } + + $x = q("update abook set abook_pending = 0 where abook_id = %d", + intval($r[0]['abook_id']) + ); + } } else { $closeness = get_pconfig($uid,'system','new_abook_closeness'); |