]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Issue 10352: Fixing photo entries for contact avatars
[friendica.git] / include / conversation.php
index ff8ecbad0054f59e18a6440a65ae2b0cafe9ee7d..4bd6ce600760b150578e566c601294086ed50774 100644 (file)
@@ -42,6 +42,7 @@ use Friendica\Object\Thread;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Proxy;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 use Friendica\Util\XML;
@@ -603,7 +604,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                        'name' => $profile_name,
                                        'sparkle' => $sparkle,
                                        'lock' => false,
-                                       'thumb' => DI::baseUrl()->remove($item['author-avatar']),
+                                       'thumb' => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['author-link'], $item['uid'], Proxy::SIZE_THUMB)),
                                        'title' => $title,
                                        'body_html' => $body_html,
                                        'tags' => $tags['tags'],
@@ -623,7 +624,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                        'indent' => '',
                                        'owner_name' => '',
                                        'owner_url' => '',
-                                       'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']),
+                                       'owner_photo' => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['owner-link'], $item['uid'], Proxy::SIZE_THUMB)),
                                        'plink' => Item::getPlink($item),
                                        'edpost' => false,
                                        'isstarred' => 'unstarred',
@@ -737,8 +738,6 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
                        }
                }
 
-               $name = $row['causer-contact-type'] == Contact::TYPE_RELAY ? $row['causer-link'] : $row['causer-name'];
-
                switch ($row['post-reason']) {
                        case Item::PR_TO:
                                $row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')];
@@ -769,9 +768,9 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
                                if (($row['gravity'] == GRAVITY_PARENT) && !empty($row['causer-id'])) {
                                        $causer = ['uid' => 0, 'id' => $row['causer-id'],
                                                'network' => $row['causer-network'], 'url' => $row['causer-link']];
-                                       $row['reshared'] = DI::l10n()->t('%s reshared this.', '<a href="'. htmlentities(Contact::magicLinkByContact($causer)) .'">' . htmlentities($name) . '</a>');
+                                       $row['reshared'] = DI::l10n()->t('%s reshared this.', '<a href="'. htmlentities(Contact::magicLinkByContact($causer)) .'">' . htmlentities($row['causer-name']) . '</a>');
                                }
-                               $row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))];
+                               $row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s <%s>', $row['causer-name'], $row['causer-link']))];
                                break;
                        case Item::PR_COMMENT:
                                $row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])];
@@ -783,10 +782,10 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
                                $row['direction'] = ['direction' => 9, 'title' => DI::l10n()->t('Global')];
                                break;
                        case Item::PR_RELAY:
-                               $row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Relayed') : DI::l10n()->t('Relayed by %s.', $name))];
+                               $row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Relayed') : DI::l10n()->t('Relayed by %s <%s>', $row['causer-name'], $row['causer-link']))];
                                break;
                        case Item::PR_FETCHED:
-                               $row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Fetched') : DI::l10n()->t('Fetched because of %s', $name))];
+                               $row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Fetched') : DI::l10n()->t('Fetched because of %s <%s>', $row['causer-name'], $row['causer-link']))];
                                break;
                        }
 
@@ -878,7 +877,7 @@ function conversation_fetch_items(array $parent, array $items, array $condition,
                $condition[0] .= " AND NOT `author-hidden`";
        }
 
-       $thread_items = Post::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['pinned', 'contact-uid', 'gravity', 'post-reason']), $condition, $params);
+       $thread_items = Post::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['pinned', 'contact-uid', 'gravity', 'post-type', 'post-reason']), $condition, $params);
 
        $comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false, $activity);
 
@@ -888,7 +887,8 @@ function conversation_fetch_items(array $parent, array $items, array $condition,
        return $items;
 }
 
-function item_photo_menu($item) {
+function item_photo_menu($item)
+{
        $sub_link = '';
        $poke_link = '';
        $contact_url = '';
@@ -929,8 +929,8 @@ function item_photo_menu($item) {
        if (!empty($pcid)) {
                $contact_url = 'contact/' . $pcid;
                $posts_link  = $contact_url . '/posts';
-               $block_link  = $contact_url . '/block';
-               $ignore_link = $contact_url . '/ignore';
+               $block_link  = $item['self'] ? '' : $contact_url . '/block';
+               $ignore_link = $item['self'] ? '' : $contact_url . '/ignore';
        }
 
        if ($cid && !$item['self']) {
@@ -983,7 +983,7 @@ function item_photo_menu($item) {
                if (strpos($v, 'javascript:') === 0) {
                        $v = substr($v, 11);
                        $o .= '<li role="menuitem"><a onclick="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
-               } elseif ($v!='') {
+               } elseif ($v) {
                        $o .= '<li role="menuitem"><a href="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
                }
        }
@@ -1211,6 +1211,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
                '$edimg'        => DI::l10n()->t('Image'),
                '$edurl'        => DI::l10n()->t('Link'),
                '$edattach'     => DI::l10n()->t('Link or Media'),
+               '$edvideo'      => DI::l10n()->t('Video'),
                '$setloc'       => DI::l10n()->t('Set your location'),
                '$shortsetloc'  => DI::l10n()->t('set location'),
                '$noloc'        => DI::l10n()->t('Clear browser location'),