Enable unfollowing contacts from all networks (but Statusnet)
This commit is contained in:
parent
e480da788e
commit
b81eaec885
2 changed files with 19 additions and 12 deletions
|
@ -595,7 +595,7 @@ function contacts_content(App $a, $update = 0)
|
||||||
/// @todo Only show the following link with DFRN when the remote version supports it
|
/// @todo Only show the following link with DFRN when the remote version supports it
|
||||||
$follow = '';
|
$follow = '';
|
||||||
$follow_text = '';
|
$follow_text = '';
|
||||||
if (in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
|
if ($contact['network'] != Protocol::STATUSNET) {
|
||||||
if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
|
if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
|
||||||
$follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
|
$follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
|
||||||
$follow_text = L10n::t("Disconnect/Unfollow");
|
$follow_text = L10n::t("Disconnect/Unfollow");
|
||||||
|
|
|
@ -28,13 +28,20 @@ function unfollow_post(App $a)
|
||||||
$return_url = $_SESSION['return_url'];
|
$return_url = $_SESSION['return_url'];
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||||
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
normalise_link($url), $url, Protocol::STATUSNET];
|
normalise_link($url), $url];
|
||||||
$contact = DBA::selectFirst('contact', [], $condition);
|
$contact = DBA::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
notice(L10n::t("Contact wasn't found or can't be unfollowed."));
|
notice(L10n::t("You aren't following this contact."));
|
||||||
goaway($return_url);
|
goaway($return_url);
|
||||||
|
// NOTREACHED
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($contact['network'] == Protocol::STATUSNET) {
|
||||||
|
notice(L10n::t('Unfollowing is currently not supported by your network.'));
|
||||||
|
goaway($return_url);
|
||||||
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) {
|
if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) {
|
||||||
|
@ -74,21 +81,21 @@ function unfollow_content(App $a)
|
||||||
|
|
||||||
$submit = L10n::t('Submit Request');
|
$submit = L10n::t('Submit Request');
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||||
local_user(), Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
local_user(), Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
normalise_link($url), $url, Protocol::STATUSNET];
|
normalise_link($url), $url];
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
notice(L10n::t("You aren't a friend of this contact.").EOL);
|
notice(L10n::t("You aren't following this contact."));
|
||||||
$submit = "";
|
goaway('contacts');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
|
if ($contact['network'] == Protocol::STATUSNET) {
|
||||||
notice(L10n::t("Unfollowing is currently not supported by your network.").EOL);
|
notice(L10n::t('Unfollowing is currently not supported by your network.'));
|
||||||
$submit = "";
|
goaway('contacts/' . $contact['id']);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue