The function moved from the user to the contact class
This commit is contained in:
parent
758eabd2f6
commit
7939cacc44
|
@ -155,6 +155,23 @@ class Contact extends BaseObject
|
|||
return PortableContact::detectServer($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the public contact id of the given user id
|
||||
*
|
||||
* @param integer $uid User ID
|
||||
*
|
||||
* @return integer|boolean Public contact id for given user id
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getPublicIdByUserId($uid)
|
||||
{
|
||||
$self = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
||||
if (!DBA::isResult($self)) {
|
||||
return false;
|
||||
}
|
||||
return self::getIdForURL($self['url'], 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the contact id for the user and the public contact id for a given contact id
|
||||
*
|
||||
|
|
|
@ -1462,8 +1462,8 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
if ($item['verb'] == ACTIVITY_FOLLOW) {
|
||||
if (!$item['origin'] && ($item['author-id'] == User::getPublicContactById($uid))) {
|
||||
// Our own follow request can be relayed to us. We don't store them to avoid notification chaos.
|
||||
if (!$item['origin'] && ($item['author-id'] == Contact::getPublicIdByUserId($uid))) {
|
||||
// Our own follow request can be relayed to us. We don't store it to avoid notification chaos.
|
||||
Logger::log("Follow: Don't store not origin follow request from us for " . $item['parent-uri'], Logger::DEBUG);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -99,20 +99,6 @@ class User
|
|||
return DBA::selectFirst('user', [], ['uid' => $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $uid
|
||||
* @return array|boolean User record if it exists, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getPublicContactById($uid)
|
||||
{
|
||||
$self = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
||||
if (!DBA::isResult($self)) {
|
||||
return false;
|
||||
}
|
||||
return Contact::getIdForURL($self['url'], 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the user id of a given profile URL
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue