Improvements for following/unfollowing of Diaspora and OStatus
This commit is contained in:
parent
dd45dcbef3
commit
8983dcaa77
4 changed files with 24 additions and 18 deletions
|
|
@ -187,14 +187,10 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
|
||||
if (dbm::is_result($r)) {
|
||||
// update contact
|
||||
if ($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
|
||||
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
|
||||
intval(CONTACT_IS_FRIEND),
|
||||
intval($subhub),
|
||||
intval($r[0]['id']),
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
$new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||
|
||||
$fields = array('rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false);
|
||||
dba::update('contact', $fields, array('id' => $r[0]['id']));
|
||||
} else {
|
||||
// check service class limits
|
||||
|
||||
|
|
@ -222,7 +218,7 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
return $result;
|
||||
}
|
||||
|
||||
$new_relation = ((in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||
$new_relation = ((in_array($ret['network'], array(NETWORK_MAIL))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||
|
||||
// create contact record
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue