mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:35:19 +00:00
fix follow id
This commit is contained in:
parent
082b8f7760
commit
4894de3c1c
1 changed files with 14 additions and 10 deletions
|
@ -2151,11 +2151,13 @@ class Activity
|
||||||
|
|
||||||
self::actor_store($person_obj['id'], $person_obj);
|
self::actor_store($person_obj['id'], $person_obj);
|
||||||
|
|
||||||
|
$actorId = new ActorId($person_obj['id']);
|
||||||
|
|
||||||
// Find any existing abook record
|
// Find any existing abook record
|
||||||
|
|
||||||
$r = q(
|
$r = q(
|
||||||
"select * from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d limit 1",
|
"select * from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d limit 1",
|
||||||
dbesc($person_obj['id']),
|
dbesc($actorId->getId()),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
);
|
);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
@ -2164,8 +2166,10 @@ class Activity
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = PermissionRoles::role_perms('social');
|
$x = PermissionRoles::role_perms('social');
|
||||||
$theirPerms = $x['perms_connect'];
|
logger('their_perms: ' . print_r($theirPerms, true));
|
||||||
|
if (!$theirPerms) {
|
||||||
|
$theirPerms = $x['perms_connect'];
|
||||||
|
}
|
||||||
// add tag_deliver permissions to remote groups (deprecated, use post_wall instead)
|
// add tag_deliver permissions to remote groups (deprecated, use post_wall instead)
|
||||||
if (is_array($person_obj) && $person_obj['type'] === 'Group' && !in_array('tag_deliver', $theirPerms)) {
|
if (is_array($person_obj) && $person_obj['type'] === 'Group' && !in_array('tag_deliver', $theirPerms)) {
|
||||||
$theirPerms[] = 'tag_deliver';
|
$theirPerms[] = 'tag_deliver';
|
||||||
|
@ -2187,11 +2191,11 @@ class Activity
|
||||||
// We've already approved them or followed them first
|
// We've already approved them or followed them first
|
||||||
// Send an Accept back to them
|
// Send an Accept back to them
|
||||||
|
|
||||||
set_abconfig($channel['channel_id'], $person_obj['id'], 'activitypub', 'their_follow_id', $their_follow_id);
|
set_abconfig($channel['channel_id'], $actorId->getId(), 'activitypub', 'their_follow_id', $their_follow_id);
|
||||||
set_abconfig($channel['channel_id'], $person_obj['id'], 'activitypub', 'their_follow_type', $act->type);
|
set_abconfig($channel['channel_id'], $actorId->getId(), 'activitypub', 'their_follow_type', $act->type);
|
||||||
// In case they unfollowed us and followed again, reset their permissions to show that we're connected again.
|
// In case they unfollowed us and followed again, reset their permissions to show that we're connected again.
|
||||||
if ($theirPerms) {
|
if ($theirPerms) {
|
||||||
AbConfig::Set($channel['channel_id'], $person_obj['id'], 'system', 'their_perms', implode(',', $theirPerms));
|
AbConfig::Set($channel['channel_id'], $actorId->getId(), 'system', 'their_perms', implode(',', $theirPerms));
|
||||||
}
|
}
|
||||||
Run::Summon(['Notifier', 'permissions_accept', $contact['abook_id']]);
|
Run::Summon(['Notifier', 'permissions_accept', $contact['abook_id']]);
|
||||||
return;
|
return;
|
||||||
|
@ -2237,18 +2241,18 @@ class Activity
|
||||||
|
|
||||||
// From here on out we assume a Follow activity from somebody we have no existing relationship with
|
// From here on out we assume a Follow activity from somebody we have no existing relationship with
|
||||||
|
|
||||||
set_abconfig($channel['channel_id'], $person_obj['id'], 'activitypub', 'their_follow_id', $their_follow_id);
|
set_abconfig($channel['channel_id'], $actorId->getId(), 'activitypub', 'their_follow_id', $their_follow_id);
|
||||||
set_abconfig($channel['channel_id'], $person_obj['id'], 'activitypub', 'their_follow_type', $act->type);
|
set_abconfig($channel['channel_id'], $actorId->getId(), 'activitypub', 'their_follow_type', $act->type);
|
||||||
|
|
||||||
// The xchan should have been created by actor_store() above
|
// The xchan should have been created by actor_store() above
|
||||||
|
|
||||||
$r = q(
|
$r = q(
|
||||||
"select * from xchan where xchan_hash = '%s' and xchan_network = 'activitypub' limit 1",
|
"select * from xchan where xchan_hash = '%s' and xchan_network = 'activitypub' limit 1",
|
||||||
dbesc($person_obj['id'])
|
dbesc($actorId->getId())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
logger('xchan not found for ' . $person_obj['id']);
|
logger('xchan not found for ' . $actorId->getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$ret = $r[0];
|
$ret = $r[0];
|
||||||
|
|
Loading…
Reference in a new issue