]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge pull request #9196 from annando/queryValue
[friendica.git] / include / conversation.php
index 0baf4a819ef06f08b323e03f3ace6e44a4b8c9b5..a995ea4ad17ee322c022c470556f6300204674b9 100644 (file)
@@ -727,7 +727,12 @@ function conversation_fetch_comments($thread_items, $pinned) {
                        && ($row['thr-parent'] == $row['parent-uri']) && ($row['received'] > $received)
                        && Contact::isSharing($row['author-id'], $row['uid'])) {
                        $direction = ['direction' => 3, 'title' => DI::l10n()->t('%s reshared this.', $row['author-name'])];
-                       $actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
+
+                       $author = ['uid' => 0, 'id' => $row['author-id'],
+                               'network' => $row['author-network'], 'url' => $row['author-link']];
+                       $url = '<a href="'. htmlentities(Contact::magicLinkByContact($author)) .'">' . htmlentities($row['author-name']) . '</a>';
+
+                       $actor = ['url' => $url, 'link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']];
                        $received = $row['received'];
                }
 
@@ -736,12 +741,38 @@ function conversation_fetch_comments($thread_items, $pinned) {
                        $direction = ['direction' => 5, 'title' => DI::l10n()->t('%s commented on this.', $row['author-name'])];
                }
 
-               if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id'])
-                       && !Contact::isSharing($row['author-id'], $row['uid'])) {
-                       if ($row['post-type'] == Item::PT_TAG) {
+               switch ($row['post-type']) {
+                       case Item::PT_TO:
+                               $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')];
+                               break;
+                       case Item::PT_CC:
+                               $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')];
+                               break;
+                       case Item::PT_BTO:
+                               $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')];
+                               break;
+                       case Item::PT_BCC:
+                               $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')];
+                               break;
+                       case Item::PT_FOLLOWER:
+                               $row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])];
+                               break;
+                       case Item::PT_TAG:
                                $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')];
-                       }
-               
+                               break;
+                       case Item::PT_ANNOUNCEMENT:
+                               $row['direction'] = ['direction' => 3, 'title' => DI::l10n()->t('Reshared')];
+                               break;
+                       case Item::PT_COMMENT:
+                               $row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])];
+                               break;
+                       case Item::PT_STORED:
+                               $row['direction'] = ['direction' => 8, 'title' => DI::l10n()->t('Stored')];
+                               break;
+               }
+
+               if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id']) &&
+                       !Contact::isSharing($row['author-id'], $row['uid'])) {
                        $parentlines[] = $lineno;
                }
 
@@ -758,10 +789,13 @@ function conversation_fetch_comments($thread_items, $pinned) {
        if (!empty($direction)) {
                foreach ($parentlines as $line) {
                        $comments[$line]['direction'] = $direction;
-                       if (!empty($actor) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')  ) {
-                               $comments[$line]['owner-link'] = $actor['link'];
-                               $comments[$line]['owner-avatar'] = $actor['avatar'];
-                               $comments[$line]['owner-name'] = $actor['name'];
+                       if (!empty($actor)) {
+                               $comments[$line]['reshared'] = DI::l10n()->t('%s reshared this.', $actor['url']);
+                               if (DI::pConfig()->get(local_user(), 'system', 'display_resharer')  ) {
+                                       $comments[$line]['owner-link'] = $actor['link'];
+                                       $comments[$line]['owner-avatar'] = $actor['avatar'];
+                                       $comments[$line]['owner-name'] = $actor['name'];
+                               }
                        }
                }
        }
@@ -1137,17 +1171,12 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
        $jotplugins = '';
        Hook::callAll('jot_tool', $jotplugins);
 
-       $query_str = DI::args()->getQueryString();
-       if (strpos($query_str, 'public=1') !== false) {
-               $query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str);
-       }
-
        // $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins));
        $tpl = Renderer::getMarkupTemplate("jot.tpl");
 
        $o .= Renderer::replaceMacros($tpl,[
                '$new_post' => DI::l10n()->t('New Post'),
-               '$return_path'  => $query_str,
+               '$return_path'  => DI::args()->getQueryString(),
                '$action'       => 'item',
                '$share'        => ($x['button'] ?? '') ?: DI::l10n()->t('Share'),
                '$loading'      => DI::l10n()->t('Loading...'),