use Friendica\Network\HTTPException;
use Friendica\Object\EMail\ItemCCEMail;
use Friendica\Protocol\Activity;
+use Friendica\Protocol\ActivityPub;
use Friendica\Util\ACLFormatter;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer;
if ($this->activity->match($item['verb'], Activity::TAG)) {
$fields = [
- 'author-id', 'author-link', 'author-name', 'author-network',
+ 'author-id', 'author-link', 'author-name', 'author-network', 'author-link', 'author-alias',
'verb', 'object-type', 'resource-id', 'body', 'plink'
];
$obj = Post::selectFirst($fields, ['uri' => $item['parent-uri']]);
$this->l10n->t('Network Posts') => $posts_link,
$this->l10n->t('View Contact') => $contact_url,
$this->l10n->t('Send PM') => $pm_url,
- $this->l10n->t('Mention') => $mention_url,
- $this->l10n->t('Post to group') => $mention_url,
$this->l10n->t('Block') => $block_link,
$this->l10n->t('Ignore') => $ignore_link,
$this->l10n->t('Collapse') => $collapse_link,
public function addSharedPost(array $item, string $body = ''): string
{
if (empty($body)) {
- $body = $item['body'];
+ $body = $item['body'] ?? '';
}
if (empty($item['quote-uri-id']) || ($item['quote-uri-id'] == $item['uri-id'])) {
$post['deny_gid'] = $owner['deny_gid'];
}
- if ($post['allow_gid'] || $post['allow_cid'] || $post['deny_gid'] || $post['deny_cid']) {
- $post['private'] = ItemModel::PRIVATE;
- } elseif ($this->pConfig->get($post['uid'], 'system', 'unlisted')) {
- $post['private'] = ItemModel::UNLISTED;
- } else {
- $post['private'] = ItemModel::PUBLIC;
+ if (!isset($post['private'])) {
+ if ($post['allow_gid'] || $post['allow_cid'] || $post['deny_gid'] || $post['deny_cid']) {
+ $post['private'] = ItemModel::PRIVATE;
+ } elseif ($this->pConfig->get($post['uid'], 'system', 'unlisted')) {
+ $post['private'] = ItemModel::UNLISTED;
+ } else {
+ $post['private'] = ItemModel::PUBLIC;
+ }
}
if (empty($post['contact-id'])) {
));
}
}
+
+ 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');
+
+ 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)) {
+ continue;
+ }
+ Tag::store($toUriId, $receiver['type'], $receiver['name'], $receiver['url']);
+ }
+ }
}