mirror of
https://github.com/friendica/friendica
synced 2024-11-19 20:23:40 +00:00
Renamed the contact relationship functions
This commit is contained in:
parent
2cb74909c0
commit
bdbfffafea
4 changed files with 10 additions and 10 deletions
|
@ -1355,7 +1355,7 @@ class Contact extends BaseObject
|
||||||
return $contact;
|
return $contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function newFollower($importer, $contact, $datarray, $item, $sharing = false) {
|
public static function addRelationship($importer, $contact, $datarray, $item, $sharing = false) {
|
||||||
$url = notags(trim($datarray['author-link']));
|
$url = notags(trim($datarray['author-link']));
|
||||||
$name = notags(trim($datarray['author-name']));
|
$name = notags(trim($datarray['author-name']));
|
||||||
$photo = notags(trim($datarray['author-avatar']));
|
$photo = notags(trim($datarray['author-avatar']));
|
||||||
|
@ -1446,7 +1446,7 @@ class Contact extends BaseObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loseFollower($importer, $contact, array $datarray = [], $item = "") {
|
public static function removeFollower($importer, $contact, array $datarray = [], $item = "") {
|
||||||
|
|
||||||
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
|
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
|
||||||
dba::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
|
dba::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
|
||||||
|
@ -1455,7 +1455,7 @@ class Contact extends BaseObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loseSharer($importer, $contact, array $datarray = [], $item = "") {
|
public static function removeSharer($importer, $contact, array $datarray = [], $item = "") {
|
||||||
|
|
||||||
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||||
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
|
||||||
|
|
|
@ -2255,22 +2255,22 @@ class DFRN
|
||||||
// This function once was responsible for DFRN and OStatus.
|
// This function once was responsible for DFRN and OStatus.
|
||||||
if (activity_match($item["verb"], ACTIVITY_FOLLOW)) {
|
if (activity_match($item["verb"], ACTIVITY_FOLLOW)) {
|
||||||
logger("New follower");
|
logger("New follower");
|
||||||
Contact::newFollower($importer, $contact, $item, $nickname);
|
Contact::addRelationship($importer, $contact, $item, $nickname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (activity_match($item["verb"], ACTIVITY_UNFOLLOW)) {
|
if (activity_match($item["verb"], ACTIVITY_UNFOLLOW)) {
|
||||||
logger("Lost follower");
|
logger("Lost follower");
|
||||||
Contact::loseFollower($importer, $contact, $item);
|
Contact::removeFollower($importer, $contact, $item);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (activity_match($item["verb"], ACTIVITY_REQ_FRIEND)) {
|
if (activity_match($item["verb"], ACTIVITY_REQ_FRIEND)) {
|
||||||
logger("New friend request");
|
logger("New friend request");
|
||||||
Contact::newFollower($importer, $contact, $item, $nickname, true);
|
Contact::addRelationship($importer, $contact, $item, $nickname, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (activity_match($item["verb"], ACTIVITY_UNFRIEND)) {
|
if (activity_match($item["verb"], ACTIVITY_UNFRIEND)) {
|
||||||
logger("Lost sharer");
|
logger("Lost sharer");
|
||||||
Contact::loseSharer($importer, $contact, $item);
|
Contact::removeSharer($importer, $contact, $item);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2502,7 +2502,7 @@ class Diaspora
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
logger("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
|
logger("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
|
||||||
Contact::loseFollower($importer, $contact);
|
Contact::removeFollower($importer, $contact);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,12 +456,12 @@ class OStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item["verb"] == ACTIVITY_FOLLOW) {
|
if ($item["verb"] == ACTIVITY_FOLLOW) {
|
||||||
Contact::newFollower($importer, $contact, $item, $nickname);
|
Contact::addRelationship($importer, $contact, $item, $nickname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") {
|
if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") {
|
||||||
Contact::loseFollower($importer, $contact, $item, $dummy);
|
Contact::removeFollower($importer, $contact, $item, $dummy);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue