mirror of
https://github.com/friendica/friendica
synced 2025-04-27 01:10:14 +00:00
Use already fetched data for magiclink
This commit is contained in:
parent
183c8fd7e2
commit
717ca0b7eb
5 changed files with 56 additions and 19 deletions
|
@ -1732,8 +1732,21 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function magicLinkbyId($cid, $url = '')
|
||||
{
|
||||
$contact = dba::selectFirst('contact', ['network', 'url', 'uid'], ['id' => $cid]);
|
||||
$contact = dba::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
|
||||
|
||||
return self::magicLinkbyContact($contact, $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a magic link to authenticate remote visitors
|
||||
*
|
||||
* @param array $contact The contact array with "uid", "network" and "url"
|
||||
* @param integer $url An url that we will be redirected to after the authentication
|
||||
*
|
||||
* @return string with "redir" link
|
||||
*/
|
||||
public static function magicLinkbyContact($contact, $url = '')
|
||||
{
|
||||
if ($contact['network'] != NETWORK_DFRN) {
|
||||
return $url ?: $contact['url']; // Equivalent to ($url != '') ? $url : $contact['url'];
|
||||
}
|
||||
|
@ -1747,7 +1760,7 @@ class Contact extends BaseObject
|
|||
return self::magicLink($contact['url'], $url);
|
||||
}
|
||||
|
||||
$redirect = 'redir/' . $cid;
|
||||
$redirect = 'redir/' . $contact['id'];
|
||||
|
||||
if ($url != '') {
|
||||
$redirect .= '?url=' . $url;
|
||||
|
|
|
@ -40,8 +40,8 @@ class Item extends BaseObject
|
|||
'wall', 'private', 'starred', 'origin', 'title', 'body', 'file', 'attach', 'language',
|
||||
'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object',
|
||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'item_id',
|
||||
'author-id', 'author-link', 'author-name', 'author-avatar',
|
||||
'owner-id', 'owner-link', 'owner-name', 'owner-avatar',
|
||||
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network',
|
||||
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network',
|
||||
'contact-id', 'contact-link', 'contact-name', 'contact-avatar',
|
||||
'writable', 'self', 'cid', 'alias',
|
||||
'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
|
||||
|
@ -422,10 +422,10 @@ class Item extends BaseObject
|
|||
$fields['item-content'] = array_merge(self::CONTENT_FIELDLIST, self::MIXED_CONTENT_FIELDLIST);
|
||||
|
||||
$fields['author'] = ['url' => 'author-link', 'name' => 'author-name',
|
||||
'thumb' => 'author-avatar', 'nick' => 'author-nick'];
|
||||
'thumb' => 'author-avatar', 'nick' => 'author-nick', 'network' => 'author-network'];
|
||||
|
||||
$fields['owner'] = ['url' => 'owner-link', 'name' => 'owner-name',
|
||||
'thumb' => 'owner-avatar', 'nick' => 'owner-nick'];
|
||||
'thumb' => 'owner-avatar', 'nick' => 'owner-nick', 'network' => 'owner-network'];
|
||||
|
||||
$fields['contact'] = ['url' => 'contact-link', 'name' => 'contact-name', 'thumb' => 'contact-avatar',
|
||||
'writable', 'self', 'id' => 'cid', 'alias', 'uid' => 'contact-uid',
|
||||
|
|
|
@ -237,7 +237,9 @@ class Term
|
|||
|
||||
$orig_tag = $tag["url"];
|
||||
|
||||
$tag["url"] = Contact::magicLinkById($item['author-id'], $tag['url']);
|
||||
$author = ['uid' => 0, 'id' => $item['author-id'],
|
||||
'network' => $item['author-network'], 'url' => $item['author-link']];
|
||||
$tag["url"] = Contact::magicLinkByContact($author, $tag['url']);
|
||||
|
||||
if ($tag["type"] == TERM_HASHTAG) {
|
||||
if ($orig_tag != $tag["url"]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue