Merge branch 'master' 2019.12 into develop

This commit is contained in:
Tobias Diekershoff 2019-12-23 20:03:47 +01:00
commit 00756737b5
66 changed files with 70843 additions and 67948 deletions

View file

@ -136,7 +136,7 @@ function common_content(App $a)
$title = '';
$tab_str = '';
if ($cmd === 'loc' && $cid && local_user() == $uid) {
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
} else {
$title = L10n::t('Common Friends');
}

View file

@ -134,7 +134,7 @@ function crepair_content(App $a)
$update_profile = in_array($contact['network'], Protocol::FEDERATED);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
$tab_str = Module\Contact::getTabsHTML($a, $contact, 6);
$tpl = Renderer::getMarkupTemplate('crepair.tpl');
$o = Renderer::replaceMacros($tpl, [

View file

@ -93,7 +93,8 @@ function display_init(App $a)
}
if ($item["id"] != $item["parent"]) {
$item = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
$parent = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
$item = $parent ?: $item;
}
$profiledata = display_fetchauthor($a, $item);
@ -171,6 +172,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
$o = '';
$item = null;
if ($update) {
$item_id = $_REQUEST['item_id'];
$item = Item::selectFirst(['uid', 'parent', 'parent-uri'], ['id' => $item_id]);
@ -220,7 +223,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
}
if (!$item_id) {
if (empty($item)) {
throw new HTTPException\NotFoundException(L10n::t('The requested item doesn\'t exist or has been deleted.'));
}
@ -242,16 +245,20 @@ function display_content(App $a, $update = false, $update_uid = 0)
$is_remote_contact = false;
$item_uid = local_user();
if (isset($item_parent_uri)) {
$parent = null;
if (!empty($item_parent_uri)) {
$parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
if (DBA::isResult($parent)) {
$a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
$a->profile['profile_uid'] = ($a->profile['profile_uid'] ?? 0) ?: $parent['uid'];
$is_remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
if ($is_remote_contact) {
$item_uid = $parent['uid'];
}
}
if (DBA::isResult($parent)) {
$a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
$a->profile['profile_uid'] = ($a->profile['profile_uid'] ?? 0) ?: $parent['uid'];
$is_remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
if ($is_remote_contact) {
$item_uid = $parent['uid'];
}
} else {
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])];
}
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);

View file

@ -14,7 +14,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Module\Login;
use Friendica\Model\Contact;
use Friendica\Model\Introduction;
use Friendica\Model\Notify;
function notifications_post(App $a)
@ -30,43 +30,20 @@ function notifications_post(App $a)
}
if ($request_id) {
$intro = DBA::selectFirst('intro', ['id', 'contact-id', 'fid'], ['id' => $request_id, 'uid' => local_user()]);
/** @var Introduction $Intro */
$Intro = \Friendica\BaseObject::getClass(Introduction::class);
$Intro->fetch(['id' => $request_id, 'uid' => local_user()]);
if (DBA::isResult($intro)) {
$intro_id = $intro['id'];
$contact_id = $intro['contact-id'];
} else {
notice(L10n::t('Invalid request identifier.') . EOL);
return;
switch ($_POST['submit']) {
case L10n::t('Discard'):
$Intro->discard();
break;
case L10n::t('Ignore'):
$Intro->ignore();
break;
}
// If it is a friend suggestion, the contact is not a new friend but an existing friend
// that should not be deleted.
$fid = $intro['fid'];
if ($_POST['submit'] == L10n::t('Discard')) {
DBA::delete('intro', ['id' => $intro_id]);
if (!$fid) {
// When the contact entry had been created just for that intro, we want to get rid of it now
$condition = ['id' => $contact_id, 'uid' => local_user(),
'self' => false, 'pending' => true, 'rel' => [0, Contact::FOLLOWER]];
$contact_pending = DBA::exists('contact', $condition);
// Remove the "pending" to stop the reappearing in any case
DBA::update('contact', ['pending' => false], ['id' => $contact_id]);
if ($contact_pending) {
Contact::remove($contact_id);
}
}
$a->internalRedirect('notifications/intros');
}
if ($_POST['submit'] == L10n::t('Ignore')) {
DBA::update('intro', ['ignore' => true], ['id' => $intro_id]);
$a->internalRedirect('notifications/intros');
}
$a->internalRedirect('notifications/intros');
}
}