if connecting to a channel that is already pending, undo the pending and set connect permissions accordingly. issue #577 - this will mostly affect channels that were connected out of band, but will also auto-friend somebody that has already connected to you, if you reciprocate prior to seeing and/or acting on the pending connection notice.
This commit is contained in:
parent
cb9e944de1
commit
6a6494d947
@ -211,7 +211,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
|
|||||||
return $result;
|
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),
|
dbesc($xchan_hash),
|
||||||
intval($uid)
|
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",
|
$x = q("update abook set abook_instance = '%s' where abook_id = %d",
|
||||||
dbesc($abook_instance),
|
dbesc($abook_instance),
|
||||||
intval($r[0]['abook_id'])
|
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 {
|
else {
|
||||||
$closeness = get_pconfig($uid,'system','new_abook_closeness');
|
$closeness = get_pconfig($uid,'system','new_abook_closeness');
|
||||||
|
Reference in New Issue
Block a user