Checks done on topmost parent in local_delivery, closes #10

This commit is contained in:
Domovoy 2012-08-18 17:17:33 +02:00
parent 441c6d79e3
commit 17f9fcaec9
2 changed files with 26 additions and 21 deletions

View file

@ -2617,6 +2617,15 @@ function local_delivery($importer,$data) {
// Specifically, the recipient? // Specifically, the recipient?
$is_a_remote_comment = false; $is_a_remote_comment = false;
$top_uri = $parent_uri;
$r = q("select `item`.`parent-uri` from `item`
WHERE `item`.`uri` = '%s'
LIMIT 1",
dbesc($parent_uri)
);
if($r && count($r)) {
$top_uri = $r[0]['parent-uri'];
// POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used? // POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`, $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
@ -2626,13 +2635,14 @@ function local_delivery($importer,$data) {
AND `item`.`uid` = %d AND `item`.`uid` = %d
$sql_extra $sql_extra
LIMIT 1", LIMIT 1",
dbesc($parent_uri), dbesc($top_uri),
dbesc($parent_uri), dbesc($top_uri),
dbesc($parent_uri), dbesc($top_uri),
intval($importer['importer_uid']) intval($importer['importer_uid'])
); );
if($r && count($r)) if($r && count($r))
$is_a_remote_comment = true; $is_a_remote_comment = true;
}
// Does this have the characteristics of a community or private group comment? // Does this have the characteristics of a community or private group comment?
// If it's a reply to a wall post on a community/prvgroup page it's a // If it's a reply to a wall post on a community/prvgroup page it's a
@ -2936,7 +2946,7 @@ function local_delivery($importer,$data) {
if(!x($datarray['type']) || $datarray['type'] != 'activity') { if(!x($datarray['type']) || $datarray['type'] != 'activity') {
$myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0", $myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0",
dbesc($parent_uri), dbesc($top_uri),
intval($importer['importer_uid']) intval($importer['importer_uid'])
); );

View file

@ -396,7 +396,7 @@ class Item extends BaseObject {
* _ false on failure * _ false on failure
*/ */
public function get_data_value($name) { public function get_data_value($name) {
if(!x($this->data, $name)) { if(!isset($this->data[$name])) {
logger('[ERROR] Item::get_data_value : Item has no value name "'. $name .'".', LOGGER_DEBUG); logger('[ERROR] Item::get_data_value : Item has no value name "'. $name .'".', LOGGER_DEBUG);
return false; return false;
} }
@ -477,8 +477,6 @@ class Item extends BaseObject {
$ww = 'ww'; $ww = 'ww';
if($conv->is_writable() && $this->is_writable()) { if($conv->is_writable() && $this->is_writable()) {
logger('[DEBUG] Item::get_comment_box : Comment box is visible.', LOGGER_DEBUG);
$a = $this->get_app(); $a = $this->get_app();
$qc = $qcomment = null; $qc = $qcomment = null;
@ -516,9 +514,6 @@ class Item extends BaseObject {
'$ww' => (($conv->get_mode() === 'network') ? $ww : '') '$ww' => (($conv->get_mode() === 'network') ? $ww : '')
)); ));
} }
else {
logger('[DEBUG] Item::get_comment_box : Comment box is NOT visible. Conv: '. ($conv->is_writable() ? 'yes' : 'no') .' Item: '. ($this->is_writable() ? 'yes' : 'no'), LOGGER_DEBUG);
}
return $comment_box; return $comment_box;
} }