]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge pull request #8319 from MrPetovan/task/8318-dislike-user-setting
[friendica.git] / include / conversation.php
index 0194e4ea56368486ca46736fa782d07391778730..f29e6d32540f2da89f55f7e9e459173ce91c0717 100644 (file)
@@ -1,6 +1,22 @@
 <?php
 /**
- * @file include/conversation.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
 
 use Friendica\App;
@@ -444,7 +460,6 @@ function conv_get_blocklist()
  * that are based on unique features of the calling module.
  * @param App    $a
  * @param array  $items
- * @param Pager  $pager
  * @param        $mode
  * @param        $update
  * @param bool   $preview
@@ -454,7 +469,7 @@ function conv_get_blocklist()
  * @throws ImagickException
  * @throws \Friendica\Network\HTTPException\InternalServerErrorException
  */
-function conversation(App $a, array $items, Pager $pager, $mode, $update, $preview = false, $order = 'commented', $uid = 0)
+function conversation(App $a, array $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0)
 {
        $ssl_state = (local_user() ? true : false);
 
@@ -490,7 +505,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                                . (!empty($_GET['cmax'])   ? '&cmax='   . rawurlencode($_GET['cmax'])   : '')
                                . (!empty($_GET['file'])   ? '&file='   . rawurlencode($_GET['file'])   : '')
 
-                               . "'; var profile_page = " . $pager->getPage() . "; </script>\r\n";
+                               . "'; </script>\r\n";
                }
        } elseif ($mode === 'profile') {
                $items = conversation_add_children($items, false, $order, $uid);
@@ -509,7 +524,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 
                                $live_update_div = '<div id="live-profile"></div>' . "\r\n"
                                        . "<script> var profile_uid = " . $a->profile['uid']
-                                       . "; var netargs = '?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
+                                       . "; var netargs = '?f='; </script>\r\n";
                        }
                }
        } elseif ($mode === 'notes') {
@@ -519,7 +534,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                if (!$update) {
                        $live_update_div = '<div id="live-notes"></div>' . "\r\n"
                                . "<script> var profile_uid = " . local_user()
-                               . "; var netargs = '/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
+                               . "; var netargs = '/?f='; </script>\r\n";
                }
        } elseif ($mode === 'display') {
                $items = conversation_add_children($items, false, $order, $uid);
@@ -528,7 +543,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                if (!$update) {
                        $live_update_div = '<div id="live-display"></div>' . "\r\n"
                                . "<script> var profile_uid = " . Session::get('uid', 0) . ";"
-                               . " var profile_page = 1; </script>";
+                               . "</script>";
                }
        } elseif ($mode === 'community') {
                $items = conversation_add_children($items, true, $order, $uid);
@@ -537,7 +552,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                if (!$update) {
                        $live_update_div = '<div id="live-community"></div>' . "\r\n"
                                . "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 10)
-                               ."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
+                               ."/?f='; </script>\r\n";
                }
        } elseif ($mode === 'contacts') {
                $items = conversation_add_children($items, false, $order, $uid);
@@ -546,7 +561,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                if (!$update) {
                        $live_update_div = '<div id="live-contacts"></div>' . "\r\n"
                                . "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 9)
-                               ."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
+                               ."/?f='; </script>\r\n";
                }
        } elseif ($mode === 'search') {
                $live_update_div = '<div id="live-search"></div>' . "\r\n";
@@ -572,6 +587,10 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                'announce' => ['title' => DI::l10n()->t('Reshares','title')]
        ];
 
+       if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+               unset($conv_responses['dislike']);
+       }
+
        // array with html for each thread (parent+comments)
        $threads = [];
        $threadsid = -1;
@@ -657,7 +676,15 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                                $isstarred = "unstarred";
 
                                $lock = false;
-                               $likebuttons = false;
+                               $likebuttons = [
+                                       'like'    => null,
+                                       'dislike' => null,
+                                       'share'   => null,
+                               ];
+
+                               if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+                                       unset($likebuttons['dislike']);
+                               }
 
                                $body = Item::prepareBody($item, true, $preview);
 
@@ -1214,6 +1241,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
                '$return_path'  => $query_str,
                '$action'       => 'item',
                '$share'        => ($x['button'] ?? '') ?: DI::l10n()->t('Share'),
+               '$loading'      => DI::l10n()->t('Loading...'),
                '$upload'       => DI::l10n()->t('Upload photo'),
                '$shortupload'  => DI::l10n()->t('upload photo'),
                '$attach'       => DI::l10n()->t('Attach file'),