mirror of
https://github.com/friendica/friendica
synced 2025-04-30 09:44:22 +02:00
Issue 13828: Use the alias as profile link if present (#13829)
* Issue 13828: Use the alias as profile link if present * Updated messages.po
This commit is contained in:
parent
5dc49352e8
commit
02123bda98
5 changed files with 35 additions and 22 deletions
|
@ -3490,6 +3490,21 @@ class Contact
|
|||
return array_column($contacts, 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the link to the profile
|
||||
*
|
||||
* @param array $contact
|
||||
* @return string
|
||||
*/
|
||||
public static function getProfileLink(array $contact): string
|
||||
{
|
||||
if (!empty($contact['alias']) && Network::isValidHttpUrl($contact['alias']) && (($contact['network'] ?? '') != Protocol::DFRN)) {
|
||||
return $contact['alias'];
|
||||
} else {
|
||||
return $contact['url'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a magic link to authenticate remote visitors
|
||||
*
|
||||
|
@ -3548,7 +3563,7 @@ class Contact
|
|||
*/
|
||||
public static function magicLinkByContact(array $contact, string $url = ''): string
|
||||
{
|
||||
$destination = $url ?: (!Network::isValidHttpUrl($contact['url']) && !empty($contact['alias']) && Network::isValidHttpUrl($contact['alias']) ? $contact['alias'] : $contact['url']);
|
||||
$destination = $url ?: self::getProfileLink($contact);
|
||||
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
return $destination;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue