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
*
}
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;
}
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
*