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

@ -987,7 +987,7 @@ class Processor
{
$parent_terms = Tag::getByURIId($parent['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
$parent_author = Contact::getDetailsByURL($parent['author-link'], 0);
$parent_author = Contact::getByURL($parent['author-link'], 0, ['url', 'nurl', 'alias'], false);
$implicit_mentions = [];
if (empty($parent_author['url'])) {
@ -1003,7 +1003,7 @@ class Processor
}
foreach ($parent_terms as $term) {
$contact = Contact::getDetailsByURL($term['url'], 0);
$contact = Contact::getByURL($term['url'], 0, ['url', 'nurl', 'alias'], false);
if (!empty($contact['url'])) {
$implicit_mentions[] = $contact['url'];
$implicit_mentions[] = $contact['nurl'];

View file

@ -1008,7 +1008,7 @@ class Transmitter
$url = DI::baseUrl() . '/search?tag=' . urlencode($term['name']);
$tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['name']];
} else {
$contact = Contact::getDetailsByURL($term['url']);
$contact = Contact::getByURL($term['url'], 0, ['addr'], false);
if (!empty($contact['addr'])) {
$mention = '@' . $contact['addr'];
} else {
@ -1141,7 +1141,7 @@ class Transmitter
return '';
}
$data = Contact::getDetailsByURL($match[1]);
$data = Contact::getByURL($match[1], 0, ['url', 'nick'], false);
if (empty($data['nick'])) {
return $match[0];
}
@ -1861,7 +1861,7 @@ class Transmitter
$mentions = [];
foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
$profile = Contact::getDetailsByURL($tag['url']);
$profile = Contact::getByURL($tag['url'], 0, ['addr', 'contact-type', 'nick'], false);
if (!empty($profile['addr'])
&& $profile['contact-type'] != Contact::TYPE_COMMUNITY
&& !strstr($body, $profile['addr'])

View file

@ -755,7 +755,7 @@ class DFRN
{
$author = $doc->createElement($element);
$contact = Contact::getDetailsByURL($contact_url, $item["uid"]);
$contact = Contact::getByURLForUser($contact_url, $item["uid"], ['url', 'name', 'addr', 'photo']);
if (!empty($contact)) {
XML::addElement($doc, $author, "name", $contact["name"]);
XML::addElement($doc, $author, "uri", $contact["url"]);

View file

@ -1568,7 +1568,7 @@ class Diaspora
*/
private static function plink($addr, $guid, $parent_guid = '')
{
$contact = Contact::getDetailsByAddr($addr);
$contact = Contact::getByURL($addr);
if (empty($contact)) {
Logger::info('No contact data for address', ['addr' => $addr]);
return '';
@ -3729,7 +3729,7 @@ class Diaspora
private static function prependParentAuthorMention($body, $profile_url)
{
$profile = Contact::getDetailsByURL($profile_url);
$profile = Contact::getByURL($profile_url, 0, ['addr', 'name', 'contact-type'], false);
if (!empty($profile['addr'])
&& $profile['contact-type'] != Contact::TYPE_COMMUNITY
&& !strstr($body, $profile['addr'])