1
1
Fork 0

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,22 +2617,32 @@ function local_delivery($importer,$data) {
// Specifically, the recipient?
$is_a_remote_comment = false;
// 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`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
AND `item`.`uid` = %d
$sql_extra
$top_uri = $parent_uri;
$r = q("select `item`.`parent-uri` from `item`
WHERE `item`.`uri` = '%s'
LIMIT 1",
dbesc($parent_uri),
dbesc($parent_uri),
dbesc($parent_uri),
intval($importer['importer_uid'])
dbesc($parent_uri)
);
if($r && count($r))
$is_a_remote_comment = true;
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?
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
AND `item`.`uid` = %d
$sql_extra
LIMIT 1",
dbesc($top_uri),
dbesc($top_uri),
dbesc($top_uri),
intval($importer['importer_uid'])
);
if($r && count($r))
$is_a_remote_comment = true;
}
// 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
@ -2936,7 +2946,7 @@ function local_delivery($importer,$data) {
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",
dbesc($parent_uri),
dbesc($top_uri),
intval($importer['importer_uid'])
);

View file

@ -396,7 +396,7 @@ class Item extends BaseObject {
* _ false on failure
*/
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);
return false;
}
@ -477,8 +477,6 @@ class Item extends BaseObject {
$ww = 'ww';
if($conv->is_writable() && $this->is_writable()) {
logger('[DEBUG] Item::get_comment_box : Comment box is visible.', LOGGER_DEBUG);
$a = $this->get_app();
$qc = $qcomment = null;
@ -516,9 +514,6 @@ class Item extends BaseObject {
'$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;
}