* @file include/conversation.php
*/
use Friendica\App;
+use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
$writable = false;
}
- if ($mode === 'network-new' || $mode === 'search' || $community_readonly) {
+ if (in_array($mode, ['network-new', 'search', 'contact-posts']) || $community_readonly) {
/*
* "New Item View" on network page or search page results
'id' => (($preview) ? 'P0' : $item['item_id']),
'guid' => (($preview) ? 'Q0' : $item['guid']),
'network' => $item['item_network'],
- 'network_name' => network_to_name($item['item_network'], $profile_link),
+ 'network_name' => ContactSelector::networkToName($item['item_network'], $profile_link),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item),
);
$comments = dba::inArray($thread_items);
+ // Check if the original item is in the result.
+ // When commenting from the community page there can be incomplete threads
+ if (count($comments) > 0) {
+ $parent_found = false;
+ foreach ($comments as $comment) {
+ if ($comment['uri'] == $comment['parent-uri']) {
+ $parent_found = true;
+ break;
+ }
+ }
+ if (!$parent_found) {
+ $comments = array();
+ }
+ }
if (count($comments) == 0) {
$thread_items = dba::p(item_query()." AND `item`.`uid` = 0
$clean_url = normalise_link($item['author-link']);
if (local_user()) {
- $r = dba::select('contact', array('id'),
- array('network' => NETWORK_DFRN, 'uid' => local_user(), 'nurl' => normalise_link($clean_url), 'pending' => false),
- array('limit' => 1));
+ $r = dba::selectOne('contact', ['id'],
+ ['network' => NETWORK_DFRN, 'uid' => local_user(), 'nurl' => normalise_link($clean_url), 'pending' => false]);
if (DBM::is_result($r)) {
$best_url = 'redir/' . $r['id'];
$sparkle = true;
$cid = 0;
$network = '';
$rel = 0;
- $r = dba::select('contact', array('id', 'network', 'rel'), array('uid' => local_user(), 'nurl' => normalise_link($item['author-link'])), array('limit' => 1));
+ $r = dba::selectOne('contact', array('id', 'network', 'rel'), array('uid' => local_user(), 'nurl' => normalise_link($item['author-link'])));
if (DBM::is_result($r)) {
$cid = $r['id'];
$network = $r['network'];