]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact.php
Merge pull request #9388 from vinzv/9383-frio-cannot-scroll-left-flyout-sidebar-on...
[friendica.git] / src / Module / Contact.php
index 4a5aeefe4fd37ecacf767a7cfb14043c2f8522b0..85b3bb423937f3b582c999725a0b0fed751c29bf 100644 (file)
@@ -32,6 +32,7 @@ use Friendica\Core\ACL;
 use Friendica\Core\Hook;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
+use Friendica\Core\Theme;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -259,9 +260,12 @@ class Contact extends BaseModule
                $rel    = Strings::escapeTags(trim($_GET['rel']    ?? ''));
                $group  = Strings::escapeTags(trim($_GET['group']  ?? ''));
 
-               if (empty(DI::page()['aside'])) {
-                       DI::page()['aside'] = '';
-               }
+               $page = DI::page();
+
+               $page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));
+               $page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
+               $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
+               $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
 
                $contact = null;
                // @TODO: Replace with parameter from router
@@ -432,17 +436,6 @@ class Contact extends BaseModule
                        if ($cmd === 'drop' && ($orig_record['uid'] != 0)) {
                                // Check if we should do HTML-based delete confirmation
                                if (!empty($_REQUEST['confirm'])) {
-                                       // <form> can't take arguments in its 'action' parameter
-                                       // so add any arguments as hidden inputs
-                                       $query = explode_querystring(DI::args()->getQueryString());
-                                       $inputs = [];
-                                       foreach ($query['args'] as $arg) {
-                                               if (strpos($arg, 'confirm=') === false) {
-                                                       $arg_parts = explode('=', $arg);
-                                                       $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]];
-                                               }
-                                       }
-
                                        DI::page()['aside'] = '';
 
                                        return Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_drop_confirm.tpl'), [
@@ -450,9 +443,8 @@ class Contact extends BaseModule
                                                '$contact' => self::getContactTemplateVars($orig_record),
                                                '$method' => 'get',
                                                '$message' => DI::l10n()->t('Do you really want to delete this contact?'),
-                                               '$extra_inputs' => $inputs,
                                                '$confirm' => DI::l10n()->t('Yes'),
-                                               '$confirm_url' => $query['base'],
+                                               '$confirm_url' => DI::args()->getCommand(),
                                                '$confirm_name' => 'confirmed',
                                                '$cancel' => DI::l10n()->t('Cancel'),
                                        ]);
@@ -660,15 +652,15 @@ class Contact extends BaseModule
                                array_unshift($sql_values, 0);
                                break;
                        case 'archived':
-                               $sql_extra = " AND `archive` AND NOT `blocked` AND NOT `pending`";
+                               $sql_extra = " AND (`archive` OR `failed`) AND NOT `blocked` AND NOT `pending`";
                                break;
                        case 'pending':
-                               $sql_extra = " AND `pending` AND NOT `archive` AND ((`rel` = ?)
+                               $sql_extra = " AND `pending` AND NOT `archive` AND NOT `failed` AND ((`rel` = ?)
                                        OR EXISTS (SELECT `id` FROM `intro` WHERE `contact-id` = `contact`.`id` AND NOT `ignore`))";
                                $sql_values[] = Model\Contact::SHARING;
                                break;
                        default:
-                               $sql_extra = " AND NOT `archive` AND NOT `blocked` AND NOT `pending`";
+                               $sql_extra = " AND NOT `archive` AND NOT `blocked` AND NOT `pending` AND NOT `failed`";
                                break;
                }
 
@@ -929,7 +921,7 @@ class Contact extends BaseModule
                return $tab_str;
        }
 
-       private static function getConversationsHMTL($a, $contact_id, $update)
+       public static function getConversationsHMTL($a, $contact_id, $update, $parent = 0)
        {
                $o = '';
 
@@ -960,14 +952,15 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        DI::page()['aside'] = '';
 
-                       $profiledata = Model\Contact::getByURL($contact['url'], false);
-
-                       Model\Profile::load($a, '', $profiledata, true);
+                       if (!$update) {
+                               $profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
+                               Model\Profile::load($a, '', $profiledata, true);
+                       }
 
                        if ($contact['uid'] == 0) {
-                               $o .= Model\Contact::getPostsFromId($contact['id'], true, $update);
+                               $o .= Model\Contact::getPostsFromId($contact['id'], true, $update, $parent);
                        } else {
-                               $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
+                               $o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update, $parent);
                        }
                }
 
@@ -983,7 +976,7 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        DI::page()['aside'] = '';
 
-                       $profiledata = Model\Contact::getByURL($contact['url'], false);
+                       $profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
 
                        if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
                                $profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);