Merge pull request #10854 from MrPetovan/bug/10844-unfollow
Replace remaining explicit network value checks by Protocol::supportsFollow calls
This commit is contained in:
commit
58215e56c3
4 changed files with 5 additions and 11 deletions
|
@ -67,7 +67,7 @@ function unfollow_content(App $a)
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
if (!Protocol::supportsFollow($contact['network'])) {
|
||||||
notice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
|
notice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
|
||||||
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
|
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
|
|
|
@ -203,10 +203,6 @@ HELP;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = ContactModel::terminateFriendship($user, $contact);
|
$result = ContactModel::terminateFriendship($user, $contact);
|
||||||
if ($result === null) {
|
|
||||||
throw new RuntimeException('Unfollowing is currently not supported by this contact\'s network.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new RuntimeException('Unable to unfollow this contact, please retry in a few minutes or check the logs.');
|
throw new RuntimeException('Unable to unfollow this contact, please retry in a few minutes or check the logs.');
|
||||||
}
|
}
|
||||||
|
@ -222,8 +218,6 @@ HELP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks a contact for removal
|
* Marks a contact for removal
|
||||||
*
|
|
||||||
* @return bool True, if the command was successful
|
|
||||||
*/
|
*/
|
||||||
private function removeContact()
|
private function removeContact()
|
||||||
{
|
{
|
||||||
|
@ -236,7 +230,7 @@ HELP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = ContactModel::remove($cid);
|
ContactModel::remove($cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -75,7 +75,7 @@ class VCard
|
||||||
$pending = $pcontact['pending'] ?? false;
|
$pending = $pcontact['pending'] ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$contact['self'] && in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
if (!$contact['self'] && Protocol::supportsFollow($contact['network'])) {
|
||||||
if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) {
|
if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) {
|
||||||
$unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
|
$unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
|
||||||
} elseif (!$pending) {
|
} elseif (!$pending) {
|
||||||
|
|
|
@ -148,9 +148,9 @@ class User
|
||||||
|
|
||||||
$contact = Contact::getById($cdata['public']);
|
$contact = Contact::getById($cdata['public']);
|
||||||
if ($blocked) {
|
if ($blocked) {
|
||||||
Protocol::block($contact);
|
Protocol::block($contact, $uid);
|
||||||
} else {
|
} else {
|
||||||
Protocol::unblock($contact);
|
Protocol::unblock($contact, $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cdata['user'] != 0) {
|
if ($cdata['user'] != 0) {
|
||||||
|
|
Loading…
Reference in a new issue