Merge pull request #9696 from MrPetovan/bug/9306-poke-privacy

Use correct request parameter type for poke privacy
This commit is contained in:
Michael Vogel 2020-12-22 17:11:37 +01:00 committed by GitHub
commit ae386a78a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -762,7 +762,7 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
} }
if (($row['gravity'] == GRAVITY_PARENT) && !empty($row['causer-id'])) { if (($row['gravity'] == GRAVITY_PARENT) && !empty($row['causer-id'])) {
$row['reshared'] = DI::l10n()->t('%s reshared this.', '<a href="'. htmlentities(Contact::magicLinkbyId($row['causer-id'])) .'">' . htmlentities($name) . '</a>'); $row['reshared'] = DI::l10n()->t('%s reshared this.', '<a href="'. htmlentities(Contact::magicLinkById($row['causer-id'])) .'">' . htmlentities($name) . '</a>');
} }
$row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))]; $row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))];
break; break;

View File

@ -1454,7 +1454,7 @@ function photos_content(App $a)
continue; continue;
} }
$profile_url = Contact::magicLinkbyId($item['author-id']); $profile_url = Contact::magicLinkById($item['author-id']);
if (strpos($profile_url, 'redir/') === 0) { if (strpos($profile_url, 'redir/') === 0) {
$sparkle = ' sparkle'; $sparkle = ' sparkle';
} else { } else {

View File

@ -2658,7 +2658,7 @@ class Contact
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
*/ */
public static function magicLinkbyId($cid, $url = '') public static function magicLinkById($cid, $url = '')
{ {
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]); $contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);

View File

@ -44,14 +44,14 @@ class Poke extends BaseModule
Logger::info('verb ' . $verb . ' contact ' . $contact_id); Logger::info('verb ' . $verb . ' contact ' . $contact_id);
$contact = DBA::selectFirst('contact', ['id', 'name'], ['id' => $parameters['id'], 'uid' => local_user()]); $contact = DBA::selectFirst('contact', ['id', 'name', 'url'], ['id' => $parameters['id'], 'uid' => local_user()]);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
return self::postReturn(false); return self::postReturn(false);
} }
$a = DI::app(); $a = DI::app();
$private = (!empty($_GET['private']) ? intval($_GET['private']) : Model\Item::PUBLIC); $private = !empty($_POST['private']) ? Model\Item::PRIVATE : Model\Item::PUBLIC;
$allow_cid = ($private ? '<' . $contact['id']. '>' : $a->user['allow_cid']); $allow_cid = ($private ? '<' . $contact['id']. '>' : $a->user['allow_cid']);
$allow_gid = ($private ? '' : $a->user['allow_gid']); $allow_gid = ($private ? '' : $a->user['allow_gid']);
@ -86,7 +86,7 @@ class Poke extends BaseModule
$arr['object-type'] = Activity\ObjectType::PERSON; $arr['object-type'] = Activity\ObjectType::PERSON;
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = '[url=' . $actor['url'] . ']' . $actor['name'] . '[/url]' . ' ' . $verbs[$verb][2] . ' ' . '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $arr['body'] = '@[url=' . $actor['url'] . ']' . $actor['name'] . '[/url]' . ' ' . $verbs[$verb][2] . ' ' . '@[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . XML::escape($contact['name']) . '</title><id>' . XML::escape($contact['url']) . '</id>'; $arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . XML::escape($contact['name']) . '</title><id>' . XML::escape($contact['url']) . '</id>';
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />') . "\n"; $arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />') . "\n";