Contact follow and unfollow workd partially
This commit is contained in:
parent
96f575fe28
commit
6a8ebc8639
5 changed files with 268 additions and 62 deletions
|
@ -28,6 +28,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -335,10 +336,17 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
intval($contact_id)
|
||||
);
|
||||
} else {
|
||||
if ($network == Protocol::ACTIVITYPUB) {
|
||||
ActivityPub::transmitContactActivity('Accept', $contact['url'], $contact['hub-verify'], $uid);
|
||||
$pending = true;
|
||||
} else {
|
||||
$pending = false;
|
||||
}
|
||||
|
||||
// $network !== Protocol::DFRN
|
||||
$network = defaults($contact, 'network', Protocol::OSTATUS);
|
||||
|
||||
$arr = Probe::uri($contact['url']);
|
||||
$arr = Probe::uri($contact['url'], $network);
|
||||
|
||||
$notify = defaults($contact, 'notify' , $arr['notify']);
|
||||
$poll = defaults($contact, 'poll' , $arr['poll']);
|
||||
|
@ -362,30 +370,12 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
|
||||
DBA::delete('intro', ['id' => $intro_id]);
|
||||
|
||||
$r = q("UPDATE `contact` SET `name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`addr` = '%s',
|
||||
`notify` = '%s',
|
||||
`poll` = '%s',
|
||||
`blocked` = 0,
|
||||
`pending` = 0,
|
||||
`network` = '%s',
|
||||
`writable` = %d,
|
||||
`hidden` = %d,
|
||||
`rel` = %d
|
||||
WHERE `id` = %d
|
||||
",
|
||||
DBA::escape(DateTimeFormat::utcNow()),
|
||||
DBA::escape(DateTimeFormat::utcNow()),
|
||||
DBA::escape($addr),
|
||||
DBA::escape($notify),
|
||||
DBA::escape($poll),
|
||||
DBA::escape($network),
|
||||
intval($writable),
|
||||
intval($hidden),
|
||||
intval($new_relation),
|
||||
intval($contact_id)
|
||||
);
|
||||
$fields = ['name-date' => DateTimeFormat::utcNow(),
|
||||
'uri-date' => DateTimeFormat::utcNow(), 'addr' => $addr,
|
||||
'notify' => $notify, 'poll' => $poll, 'blocked' => false,
|
||||
'pending' => $pending, 'network' => $network,
|
||||
'writable' => $writable, 'hidden' => $hidden, 'rel' => $new_relation];
|
||||
DBA::update('contact', $fields, ['id' => $contact_id]);
|
||||
}
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
|
|
|
@ -31,7 +31,8 @@ function follow_post(App $a)
|
|||
// This is just a precaution if maybe this page is called somewhere directly via POST
|
||||
$_SESSION['fastlane'] = $url;
|
||||
|
||||
$result = Contact::createFromProbe($uid, $url, true);
|
||||
$result = Contact::createFromProbe($uid, $url, true, Protocol::ACTIVITYPUB);
|
||||
// $result = Contact::createFromProbe($uid, $url, true);
|
||||
|
||||
if ($result['success'] == false) {
|
||||
if ($result['message']) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue