mirror of
https://github.com/friendica/friendica
synced 2024-12-23 14:40:16 +00:00
Convert "followers" path when copying receivers
This commit is contained in:
parent
a7c985a590
commit
308401b9e5
1 changed files with 10 additions and 0 deletions
|
@ -1074,8 +1074,18 @@ class Item
|
||||||
|
|
||||||
public function copyPermissions(int $fromUriId, int $toUriId)
|
public function copyPermissions(int $fromUriId, int $toUriId)
|
||||||
{
|
{
|
||||||
|
$from = Post::selectFirstPost(['author-id'], ['uri-id' => $fromUriId]);
|
||||||
|
$from_author = DBA::selectFirst('account-view', ['ap-followers'], ['id' => $from['author-id']]);
|
||||||
|
$to = Post::selectFirstPost(['author-id'], ['uri-id' => $toUriId]);
|
||||||
|
$to_author = DBA::selectFirst('account-view', ['ap-followers'], ['id' => $to['author-id']]);
|
||||||
|
|
||||||
$existing = array_column(Tag::getByURIId($toUriId, [Tag::TO, Tag::CC, Tag::BCC]), 'url');
|
$existing = array_column(Tag::getByURIId($toUriId, [Tag::TO, Tag::CC, Tag::BCC]), 'url');
|
||||||
|
|
||||||
foreach (Tag::getByURIId($fromUriId, [Tag::TO, Tag::CC, Tag::BCC]) as $receiver) {
|
foreach (Tag::getByURIId($fromUriId, [Tag::TO, Tag::CC, Tag::BCC]) as $receiver) {
|
||||||
|
if ($receiver['url'] == $from_author['ap-followers']) {
|
||||||
|
$receiver['url'] = $to_author['ap-followers'];
|
||||||
|
$receiver['name'] = trim(parse_url($receiver['url'], PHP_URL_PATH), '/');
|
||||||
|
}
|
||||||
if (in_array($receiver['url'], $existing)) {
|
if (in_array($receiver['url'], $existing)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue