Use the function from the contact template instead
This commit is contained in:
parent
91b0f2c486
commit
893f6bd692
|
@ -20,13 +20,11 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -123,9 +121,9 @@ function common_content(App $a)
|
|||
|
||||
$entries = [];
|
||||
foreach ($common_friends as $common_friend) {
|
||||
$contact = Model\Contact::getByURL($common_friend['url']);
|
||||
$contact = Model\Contact::getByURLForUser($common_friend['url'], local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[] = Model\Contact::getTemplateData($contact, ++$id);
|
||||
$entries[] = Module\Contact::getContactTemplateVars($contact, ++$id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Contact as ModuleContact;
|
||||
|
||||
/**
|
||||
* Controller for /match.
|
||||
|
@ -91,9 +92,9 @@ function match_content(App $a)
|
|||
continue;
|
||||
}
|
||||
|
||||
$contact = Contact::getByURL($profile->url);
|
||||
$contact = Contact::getByURLForUser($profile->url, local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[] = Contact::getTemplateData($contact, $i);
|
||||
$entries[] = ModuleContact::getContactTemplateVars($contact, $i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\Contact as ModuleContact;
|
||||
|
||||
function suggest_init(App $a)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ function suggest_content(App $a)
|
|||
$entries = [];
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
$entries[] = Contact::getTemplateData($contact, ++$id);
|
||||
$entries[] = ModuleContact::getContactTemplateVars($contact, ++$id);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
|
|
@ -3069,22 +3069,4 @@ class Contact
|
|||
|
||||
return array_slice($contacts, $start, $limit);
|
||||
}
|
||||
|
||||
public static function getTemplateData(array $contact, int $id)
|
||||
{
|
||||
return [
|
||||
'url' => self::magicLink($contact['url']),
|
||||
'itemurl' => $contact['addr'] ?: $contact['url'],
|
||||
'name' => $contact['name'],
|
||||
'thumb' => self::getThumb($contact),
|
||||
'img_hover' => $contact['url'],
|
||||
'details' => $contact['location'],
|
||||
'tags' => $contact['keywords'],
|
||||
'about' => $contact['about'],
|
||||
'account_type' => self::getAccountType($contact),
|
||||
'network' => ContactSelector::networkToName($contact['network'], $contact['url']),
|
||||
'photo_menu' => self::photoMenu($contact),
|
||||
'id' => $id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
@ -77,9 +76,9 @@ class AllFriends extends BaseModule
|
|||
|
||||
$entries = [];
|
||||
foreach ($friends as $friend) {
|
||||
$contact = Model\Contact::getByURL($friend['url']);
|
||||
$contact = Model\Contact::getByURLForUser($friend['url'], local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[] = Model\Contact::getTemplateData($contact, ++$id);
|
||||
$entries[] = Contact::getContactTemplateVars($contact, ++$id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
|
@ -125,9 +124,9 @@ class BaseSearch extends BaseModule
|
|||
|
||||
// in case the result is a contact result, add a contact-specific entry
|
||||
if ($result instanceof ContactResult) {
|
||||
$contact = Model\Contact::getByURL($result->getUrl());
|
||||
$contact = Model\Contact::getByURLForUser($result->getUrl(), local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[] = Model\Contact::getTemplateData($contact, ++$id);
|
||||
$entries[] = Contact::getContactTemplateVars($contact, ++$id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1009,7 +1009,14 @@ class Contact extends BaseModule
|
|||
return $o;
|
||||
}
|
||||
|
||||
public static function getContactTemplateVars(array $rr)
|
||||
/**
|
||||
* Return the fields for the contact template
|
||||
*
|
||||
* @param array $rr Contact array
|
||||
* @param integer $id
|
||||
* @return array Template fields
|
||||
*/
|
||||
public static function getContactTemplateVars(array $rr, int $id = 0)
|
||||
{
|
||||
$dir_icon = '';
|
||||
$alt_text = '';
|
||||
|
@ -1069,12 +1076,16 @@ class Contact extends BaseModule
|
|||
'thumb' => Model\Contact::getThumb($rr),
|
||||
'name' => $rr['name'],
|
||||
'username' => $rr['name'],
|
||||
'details' => $rr['location'],
|
||||
'tags' => $rr['keywords'],
|
||||
'about' => $rr['about'],
|
||||
'account_type' => Model\Contact::getAccountType($rr),
|
||||
'sparkle' => $sparkle,
|
||||
'itemurl' => ($rr['addr'] ?? '') ?: $rr['url'],
|
||||
'url' => $url,
|
||||
'network' => ContactSelector::networkToName($rr['network'], $rr['url'], $rr['protocol']),
|
||||
'nick' => $rr['nick'],
|
||||
'id' => $id,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user