// if this isn't the real parent of the conversation, find it
if($r !== false && count($r)) {
$parid = $r[0]['parent'];
+ $parent_uri = $r[0]['uri'];
if($r[0]['id'] != $r[0]['parent']) {
$r = q("SELECT * FROM `item` WHERE `id` = `parent` AND `parent` = %d LIMIT 1",
intval($parid)
$parent = $r[0]['id'];
// multi-level threading - preserve the info but re-parent to our single level threading
- if(($parid) && ($parid != $parent))
+ //if(($parid) && ($parid != $parent))
$thr_parent = $parent_uri;
if($parent_item['contact-id'] && $uid) {
$author = null;
$self = false;
+ $contact_id = 0;
if((local_user()) && (local_user() == $profile_uid)) {
$self = true;
);
}
elseif(remote_user()) {
- $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
- intval(remote_user())
- );
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $profile_uid) {
+ $contact_id = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($contact_id) {
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
+ intval($contact_id)
+ );
+ }
}
if(count($r)) {
$uri = item_new_uri($a->get_hostname(),$profile_uid);
+ // Fallback so that we alway have a thr-parent
+ if(!$thr_parent)
+ $thr_parent = $uri;
+
$datarray = array();
$datarray['uid'] = $profile_uid;
$datarray['type'] = $post_type;
if($preview) {
require_once('include/conversation.php');
- $o = conversation($a,array(array_merge($contact_record,$datarray)),'search',false,true);
+ $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false, true);
logger('preview: ' . $o);
echo json_encode(array('preview' => $o));
killme();
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $parent,
+ 'parent_uri' => $parent_item['uri']
));
}