make cards searchable

This commit is contained in:
zotlabs 2017-08-24 18:15:19 -07:00
parent bd84a3ee08
commit 341386a95b
3 changed files with 20 additions and 15 deletions

View File

@ -736,19 +736,6 @@ class Item extends \Zotlabs\Web\Controller {
$parent_mid = $parent_item['mid'];
// fix permalinks for cards
if($webpage == ITEM_TYPE_CARD && $pagetitle) {
$plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . $pagetitle;
}
if(($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_CARD)) {
$r = q("select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.iid = %d limit 1",
intval($parent_item['id'])
);
if($r) {
$plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . $r[0]['v'];
}
}
// Fallback so that we alway have a thr_parent
@ -759,6 +746,21 @@ class Item extends \Zotlabs\Web\Controller {
$item_thread_top = ((! $parent) ? 1 : 0);
// fix permalinks for cards
if($webpage == ITEM_TYPE_CARD) {
$plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : substr($mid,0,16));
}
if(($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_CARD)) {
$r = q("select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.iid = %d limit 1",
intval($parent_item['id'])
);
if($r) {
$plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . $r[0]['v'];
}
}
if ((! $plink) && ($item_thread_top)) {
$plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
}

View File

@ -703,6 +703,9 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$is_new = true;
$conv_link = (($item['item_type'] == ITEM_TYPE_CARD) ? $item['plink'] : z_root() . '/display/' . gen_link_id($item['mid']));
$tmp_item = array(
'template' => $tpl,
'toplevel' => 'toplevel_item',
@ -757,7 +760,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
'like' => '',
'dislike' => '',
'comment' => '',
'conv' => (($preview) ? '' : array('href'=> z_root() . '/display/' . gen_link_id($item['mid']), 'title'=> t('View in context'))),
'conv' => (($preview) ? '' : array('href'=> $conv_link, 'title'=> t('View in context'))),
'previewing' => $previewing,
'wait' => t('Please wait'),
'thread_level' => 1,

View File

@ -177,7 +177,7 @@ function item_normal() {
}
function item_normal_search() {
return " and item.item_hidden = 0 and item.item_type in (0,3) and item.item_deleted = 0
return " and item.item_hidden = 0 and item.item_type in (0,3,6) and item.item_deleted = 0
and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
and item.item_blocked = 0 ";
}