Merge remote-tracking branch 'upstream/develop' into ap2

This commit is contained in:
Michael 2018-10-03 06:16:23 +00:00
commit 4528d8748c
4 changed files with 38 additions and 35 deletions

View file

@ -162,11 +162,7 @@ function contacts_batch_actions(App $a)
info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions)); info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions));
} }
if (x($_SESSION, 'return_url')) { goaway('contacts');
goaway('' . $_SESSION['return_url']);
} else {
goaway('contacts');
}
} }
function contacts_post(App $a) function contacts_post(App $a)
@ -470,20 +466,13 @@ function contacts_content(App $a, $update = 0)
} }
// Now check how the user responded to the confirmation query // Now check how the user responded to the confirmation query
if (x($_REQUEST, 'canceled')) { if (x($_REQUEST, 'canceled')) {
if (x($_SESSION, 'return_url')) { goaway('contacts');
goaway('' . $_SESSION['return_url']);
} else {
goaway('contacts');
}
} }
_contact_drop($orig_record); _contact_drop($orig_record);
info(L10n::t('Contact has been removed.') . EOL); info(L10n::t('Contact has been removed.') . EOL);
if (x($_SESSION, 'return_url')) {
goaway('' . $_SESSION['return_url']); goaway('contacts');
} else {
goaway('contacts');
}
return; // NOTREACHED return; // NOTREACHED
} }
if ($cmd === 'posts') { if ($cmd === 'posts') {

View file

@ -20,12 +20,12 @@ function follow_post(App $a)
} }
if (isset($_REQUEST['cancel'])) { if (isset($_REQUEST['cancel'])) {
goaway($_SESSION['return_url']); goaway('contacts');
} }
$uid = local_user(); $uid = local_user();
$url = notags(trim($_REQUEST['url'])); $url = notags(trim($_REQUEST['url']));
$return_url = $_SESSION['return_url']; $return_url = 'contacts';
// Makes the connection request for friendica contacts easier // Makes the connection request for friendica contacts easier
// This is just a precaution if maybe this page is called somewhere directly via POST // This is just a precaution if maybe this page is called somewhere directly via POST
@ -39,7 +39,7 @@ function follow_post(App $a)
} }
goaway($return_url); goaway($return_url);
} elseif ($result['cid']) { } elseif ($result['cid']) {
goaway(System::baseUrl() . '/contacts/' . $result['cid']); goaway('contacts/' . $result['cid']);
} }
info(L10n::t('The contact could not be added.')); info(L10n::t('The contact could not be added.'));
@ -50,9 +50,11 @@ function follow_post(App $a)
function follow_content(App $a) function follow_content(App $a)
{ {
$return_url = 'contacts';
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
goaway($_SESSION['return_url']); goaway($return_url);
// NOTREACHED // NOTREACHED
} }
@ -116,7 +118,7 @@ function follow_content(App $a)
if (!$r) { if (!$r) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
goaway($_SESSION['return_url']); goaway($return_url);
// NOTREACHED // NOTREACHED
} }

View file

@ -154,17 +154,28 @@ function message_content(App $a)
// Now check how the user responded to the confirmation query // Now check how the user responded to the confirmation query
if (!empty($_REQUEST['canceled'])) { if (!empty($_REQUEST['canceled'])) {
goaway($_SESSION['return_url']); goaway('/message');
} }
$cmd = $a->argv[1]; $cmd = $a->argv[1];
if ($cmd === 'drop') { if ($cmd === 'drop') {
$message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
if(!DBA::isResult($message)){
info(L10n::t('Conversation not found.') . EOL);
goaway('/message');
}
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) { if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
info(L10n::t('Message deleted.') . EOL); info(L10n::t('Message deleted.') . EOL);
} }
//goaway(System::baseUrl(true) . '/message' ); $conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
goaway($_SESSION['return_url']); if(!DBA::isResult($conversation)){
info(L10n::t('Conversation removed.') . EOL);
goaway('/message');
}
goaway('/message/' . $conversation['id'] );
} else { } else {
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
@ -178,8 +189,7 @@ function message_content(App $a)
info(L10n::t('Conversation removed.') . EOL); info(L10n::t('Conversation removed.') . EOL);
} }
} }
//goaway(System::baseUrl(true) . '/message' ); goaway('/message' );
goaway($_SESSION['return_url']);
} }
} }

View file

@ -14,18 +14,14 @@ use Friendica\Model\User;
function unfollow_post() function unfollow_post()
{ {
$return_url = $_SESSION['return_url']; $return_url = 'contacts';
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
goaway($return_url); goaway('/login');
// NOTREACHED // NOTREACHED
} }
if (!empty($_REQUEST['cancel'])) {
goaway($return_url);
}
$uid = local_user(); $uid = local_user();
$url = notags(trim(defaults($_REQUEST, 'url', ''))); $url = notags(trim(defaults($_REQUEST, 'url', '')));
@ -40,9 +36,13 @@ function unfollow_post()
// NOTREACHED // NOTREACHED
} }
if (!empty($_REQUEST['cancel'])) {
goaway($return_url . '/' . $contact['id']);
}
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
notice(L10n::t('Unfollowing is currently not supported by your network.')); notice(L10n::t('Unfollowing is currently not supported by your network.'));
goaway($return_url); goaway($return_url . '/' . $contact['id']);
// NOTREACHED // NOTREACHED
} }
@ -69,9 +69,11 @@ function unfollow_post()
function unfollow_content(App $a) function unfollow_content(App $a)
{ {
$return_url = 'contacts';
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
goaway($_SESSION['return_url']); goaway('/login');
// NOTREACHED // NOTREACHED
} }
@ -86,7 +88,7 @@ function unfollow_content(App $a)
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
notice(L10n::t("You aren't following this contact.")); notice(L10n::t("You aren't following this contact."));
goaway('contacts'); goaway($return_url);
// NOTREACHED // NOTREACHED
} }
@ -103,7 +105,7 @@ function unfollow_content(App $a)
if (!DBA::isResult($self)) { if (!DBA::isResult($self)) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
goaway($_SESSION['return_url']); goaway($return_url);
// NOTREACHED // NOTREACHED
} }