Threaded comments will now be transmitted
This commit is contained in:
parent
ce4c542e37
commit
6a511066c4
|
@ -1145,18 +1145,22 @@ class Diaspora {
|
||||||
*
|
*
|
||||||
* @param string $author Author handle
|
* @param string $author Author handle
|
||||||
* @param string $guid Message guid
|
* @param string $guid Message guid
|
||||||
|
* @param boolean $onlyfound Only return uri when found in the database
|
||||||
*
|
*
|
||||||
* @return string The constructed uri or the one from our database
|
* @return string The constructed uri or the one from our database
|
||||||
*/
|
*/
|
||||||
private function get_uri_from_guid($author, $guid) {
|
private static function get_uri_from_guid($author, $guid, $onlyfound = false) {
|
||||||
|
|
||||||
$r = q("SELECT `uri` FROM `item` WHERE `guid` = '%s' LIMIT 1", dbesc($guid));
|
$r = q("SELECT `uri` FROM `item` WHERE `guid` = '%s' LIMIT 1", dbesc($guid));
|
||||||
if ($r)
|
if (dbm::is_result($r)) {
|
||||||
return $r[0]["uri"];
|
return $r[0]["uri"];
|
||||||
else
|
} elseif (!$onlyfound) {
|
||||||
return $author.":".$guid;
|
return $author.":".$guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fetch the guid from our database with a given uri
|
* @brief Fetch the guid from our database with a given uri
|
||||||
*
|
*
|
||||||
|
@ -1196,6 +1200,13 @@ class Diaspora {
|
||||||
$created_at = datetime_convert();
|
$created_at = datetime_convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($data->thread_parent_guid)) {
|
||||||
|
$thread_parent_guid = notags(unxmlify($data->thread_parent_guid));
|
||||||
|
$thr_uri = self::get_uri_from_guid("", $thread_parent_guid, true);
|
||||||
|
} else {
|
||||||
|
$thr_uri = "";
|
||||||
|
}
|
||||||
|
|
||||||
$contact = self::allowed_contact_by_handle($importer, $sender, true);
|
$contact = self::allowed_contact_by_handle($importer, $sender, true);
|
||||||
if (!$contact) {
|
if (!$contact) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1240,7 +1251,12 @@ class Diaspora {
|
||||||
$datarray["type"] = "remote-comment";
|
$datarray["type"] = "remote-comment";
|
||||||
$datarray["verb"] = ACTIVITY_POST;
|
$datarray["verb"] = ACTIVITY_POST;
|
||||||
$datarray["gravity"] = GRAVITY_COMMENT;
|
$datarray["gravity"] = GRAVITY_COMMENT;
|
||||||
|
|
||||||
|
if ($thr_uri != "") {
|
||||||
|
$datarray["parent-uri"] = $thr_uri;
|
||||||
|
} else {
|
||||||
$datarray["parent-uri"] = $parent_item["uri"];
|
$datarray["parent-uri"] = $parent_item["uri"];
|
||||||
|
}
|
||||||
|
|
||||||
$datarray["object-type"] = ACTIVITY_OBJ_COMMENT;
|
$datarray["object-type"] = ACTIVITY_OBJ_COMMENT;
|
||||||
$datarray["object"] = $xml;
|
$datarray["object"] = $xml;
|
||||||
|
|
Loading…
Reference in a new issue