]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact.php
Issue-9358 (now for real) commenting and updating on contact now work
[friendica.git] / src / Module / Contact.php
index 6425df8df1e58417def5833a904d852d63d5b02c..cc4f4d9abedda01c6bca64dfee34eb96dff3c7fc 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'),
                                        ]);
@@ -558,7 +550,7 @@ class Contact extends BaseModule
                        }
 
                        $poll_interval = null;
-                       if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
+                       if ((($contact['network'] == Protocol::FEED) && !DI::config()->get('system', 'adjust_poll_frequency')) || ($contact['network']== Protocol::MAIL)) {
                                $poll_interval = ContactSelector::pollInterval($contact['priority'], !$poll_enabled);
                        }
 
@@ -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']);