Replaced "getDetailsByURL" with "getByURL/getByURLForUser"

This commit is contained in:
Michael 2020-07-15 04:42:04 +00:00
parent 869f3cfec4
commit d9c6a46ffe
29 changed files with 78 additions and 285 deletions

View file

@ -108,7 +108,7 @@ class Advanced extends BaseModule
throw new BadRequestException(DI::l10n()->t('Contact not found.'));
}
Model\Profile::load(DI::app(), "", Model\Contact::getDetailsByURL($contact["url"]));
Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], 0, [], false));
$warning = DI::l10n()->t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
$info = DI::l10n()->t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');

View file

@ -58,31 +58,16 @@ class Hovercard extends BaseModule
$contact = [];
// if it's the url containing https it should be converted to http
$contact_nurl = Strings::normaliseLink(GContact::cleanContactUrl($contact_url));
if (!$contact_nurl) {
if (!$contact_url) {
throw new HTTPException\BadRequestException();
}
// Search for contact data
// Look if the local user has got the contact
if (Session::isAuthenticated()) {
$contact = Contact::getDetailsByURL($contact_nurl, local_user());
}
// If not then check the global user
if (!count($contact)) {
$contact = Contact::getDetailsByURL($contact_nurl);
}
// Feeds url could have been destroyed through "cleanContactUrl", so we now use the original url
if (!count($contact) && Session::isAuthenticated()) {
$contact_nurl = Strings::normaliseLink($contact_url);
$contact = Contact::getDetailsByURL($contact_nurl, local_user());
}
if (!count($contact)) {
$contact_nurl = Strings::normaliseLink($contact_url);
$contact = Contact::getDetailsByURL($contact_nurl);
$contact = Contact::getByURLForUser($contact_url, local_user(), [], false);
} else {
$contact = Contact::getByURL($contact_url, 0, [], false);
}
if (!count($contact)) {
@ -110,7 +95,7 @@ class Hovercard extends BaseModule
'about' => $contact['about'],
'network_link' => Strings::formatNetworkName($contact['network'], $contact['url']),
'tags' => $contact['keywords'],
'bd' => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
'bd' => $contact['bd'] <= DBA::NULL_DATE ? '' : $contact['bd'],
'account_type' => Contact::getAccountType($contact),
'actions' => $actions,
],

View file

@ -138,7 +138,7 @@ class Poke extends BaseModule
throw new HTTPException\NotFoundException();
}
Model\Profile::load(DI::app(), '', Model\Contact::getDetailsByURL($contact["url"]));
Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], 0, [], false));
$verbs = [];
foreach (DI::l10n()->getPokeVerbs() as $verb => $translations) {