`deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
`origin` boolean NOT NULL DEFAULT '0' COMMENT '',
`forum_mode` tinyint NOT NULL DEFAULT 0 COMMENT '',
- `last-child` boolean NOT NULL DEFAULT '1' COMMENT '',
`mention` boolean NOT NULL DEFAULT '0' COMMENT '',
`network` varchar(32) NOT NULL DEFAULT '' COMMENT '',
`rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
$arr['allow_gid'] = $allow_gid;
$arr['deny_cid'] = $deny_cid;
$arr['deny_gid'] = $deny_gid;
- $arr['last-child'] = 1;
$arr['visible'] = $visibility;
$arr['origin'] = 1;
`item`.`deleted`,
`item`.`origin`,
`item`.`forum_mode`,
-`item`.`last-child`,
`item`.`mention`,
`item`.`global`,
`item`.`gcontact-id`,
$item_arr['deny_cid'] = $arr['deny_cid'];
$item_arr['deny_gid'] = $arr['deny_gid'];
$item_arr['private'] = $arr['private'];
- $item_arr['last-child'] = 1;
$item_arr['visible'] = 1;
$item_arr['verb'] = ACTIVITY_POST;
$item_arr['object-type'] = ACTIVITY_OBJ_EVENT;
$arr['wall'] = 1;
$arr['type'] = 'wall';
$arr['origin'] = 1;
- $arr['last-child'] = 1;
$arr['network'] = NETWORK_DFRN;
$arr['protocol'] = PROTOCOL_DFRN;
$arr['title'] = ((x($arr, 'title')) ? trim($arr['title']) : '');
$arr['location'] = ((x($arr, 'location')) ? trim($arr['location']) : '');
$arr['coord'] = ((x($arr, 'coord')) ? notags(trim($arr['coord'])) : '');
- $arr['last-child'] = ((x($arr, 'last-child')) ? intval($arr['last-child']) : 0 );
$arr['visible'] = ((x($arr, 'visible') !== false) ? intval($arr['visible']) : 1 );
$arr['deleted'] = 0;
$arr['parent-uri'] = ((x($arr, 'parent-uri')) ? notags(trim($arr['parent-uri'])) : $arr['uri']);
create_tags_from_item($current_post);
Term::createFromItem($current_post);
- /*
- * If this is now the last-child, force all _other_ children of this parent to *not* be last-child
- * It is done after the transaction to avoid dead locks.
- */
- if ($arr['last-child']) {
- q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d AND `id` != %d",
- dbesc($arr['uri']),
- intval($arr['uid']),
- intval($current_post)
- );
- }
-
if ($arr['parent-uri'] === $arr['uri']) {
Item::addShadow($current_post);
} else {
'deny_gid' => $item['deny_gid'],
'visible' => 1,
'unseen' => 1,
- 'last-child' => 0
];
$new_item_id = item_store($new_item);
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
- $arr['last-child'] = 1;
-
$arr['allow_cid'] = $user['allow_cid'];
$arr['allow_gid'] = $user['allow_gid'];
$arr['deny_cid'] = $user['deny_cid'];
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $combined['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
- $arr['last-child'] = 1;
-
$arr['allow_cid'] = $user['allow_cid'];
$arr['allow_gid'] = $user['allow_gid'];
$arr['deny_cid'] = $user['deny_cid'];
$datarray['gcontact-id'] = GContact::getId(["url" => $datarray['author-link'], "network" => $datarray['network'],
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']]);
$datarray['object'] = $object;
- $datarray['last-child'] = 1;
/*
* These fields are for the convenience of plugins...
$arr['allow_gid'] = $p[0]['allow_gid'];
$arr['deny_cid'] = $p[0]['deny_cid'];
$arr['deny_gid'] = $p[0]['deny_gid'];
- $arr['last-child'] = 1;
$arr['visible'] = $visibility;
$arr['origin'] = 1;
$arr['allow_gid'] = $p[0]['allow_gid'];
$arr['deny_cid'] = $p[0]['deny_cid'];
$arr['deny_gid'] = $p[0]['deny_gid'];
- $arr['last-child'] = 1;
$arr['visible'] = 1;
$arr['verb'] = ACTIVITY_TAG;
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['allow_gid'] = $str_group_allow;
$arr['deny_cid'] = $str_contact_deny;
$arr['deny_gid'] = $str_group_deny;
- $arr['last-child'] = 1;
$arr['visible'] = $visible;
$arr['origin'] = 1;
}
if (!DBM::is_result($r)) {
- if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) {
+ if (($can_post || can_write_wall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl, [
'$return_path' => '',
'$jsreload' => $return_url,
$dislike = format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike', $link_item['id']);
}
- if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) {
+ if (($can_post || can_write_wall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl,[
'$return_path' => '',
'$jsreload' => $return_url,
'$comment' => $comment
]);
- if (($can_post || can_write_wall($owner_uid)) && $item['last-child']) {
+ if (($can_post || can_write_wall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl, [
'$return_path' => '',
'$jsreload' => $return_url,
$arr['allow_gid'] = $allow_gid;
$arr['deny_cid'] = $deny_cid;
$arr['deny_gid'] = $deny_gid;
- $arr['last-child'] = 1;
$arr['visible'] = 1;
$arr['verb'] = $activity;
$arr['private'] = $private;
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $self[0]['url'] . '?tab=profile' . '" />' . "\n");
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $self[0]['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
- $arr['last-child'] = 1;
$arr['allow_cid'] = $a->user['allow_cid'];
$arr['allow_gid'] = $a->user['allow_gid'];
$arr['deny_gid'] = $item['deny_gid'];
$arr['visible'] = 1;
$arr['unseen'] = 1;
- $arr['last-child'] = 0;
$post_id = item_store($arr);
$arr['deny_gid'] = $item['deny_gid'];
$arr['visible'] = 1;
$arr['unseen'] = 1;
- $arr['last-child'] = 1;
$arr['origin'] = 1;
$post_id = item_store($arr);
"deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"forum_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
- "last-child" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
"mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
"rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
// "comment-allow" is some old fashioned stuff for old Friendica versions.
// It is included in the rewritten code for completeness
if ($comment) {
- XML::addElement($doc, $entry, "dfrn:comment-allow", intval($item['last-child']));
+ XML::addElement($doc, $entry, "dfrn:comment-allow", 1);
}
if ($item['location']) {
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $current["id"]);
}
}
-
- // update last-child if it changes
- if ($item["last-child"] && ($item["last-child"] != $current["last-child"])) {
- $r = q(
- "UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
- dbesc(datetime_convert()),
- dbesc($item["parent-uri"]),
- intval($importer["importer_uid"])
- );
- $r = q(
- "UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` IN (0, %d)",
- intval($item["last-child"]),
- dbesc(datetime_convert()),
- dbesc($item["uri"]),
- intval($importer["importer_uid"])
- );
- }
return $changed;
}
$item["edited"] = $xpath->query("atom:updated/text()", $entry)->item(0)->nodeValue;
$current = q(
- "SELECT `id`, `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ "SELECT `id`, `uid`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item["uri"]),
intval($importer["importer_uid"])
);
// We don't need the content element since "dfrn:env" is always present
//$item["body"] = $xpath->query("atom:content/text()", $entry)->item(0)->nodeValue;
- $item["last-child"] = $xpath->query("dfrn:comment-allow/text()", $entry)->item(0)->nodeValue;
$item["location"] = $xpath->query("dfrn:location/text()", $entry)->item(0)->nodeValue;
$georsspoint = $xpath->query("georss:point", $entry);
$parent_uri = $r[0]["parent-uri"];
}
- if (!$is_like) {
- $r1 = q(
- "UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
- dbesc(datetime_convert()),
- intval($importer["importer_uid"]),
- intval($r[0]["parent"])
- );
-
- $r2 = q(
- "UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d",
- dbesc(datetime_convert()),
- intval($importer["importer_uid"]),
- intval($posted_id)
- );
- }
-
if ($posted_id && $parent && ($entrytype == DFRN_REPLY_RC)) {
logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $posted_id);
create_tags_from_itemuri($uri, $importer["uid"]);
Term::createFromItemURI($uri, $importer["uid"]);
update_thread_uri($uri, $importer["importer_uid"]);
- if ($item["last-child"]) {
- // ensure that last-child is set in case the comment that had it just got wiped.
- q(
- "UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
- dbesc(datetime_convert()),
- dbesc($item["parent-uri"]),
- intval($item["uid"])
- );
- // who is the last child now?
- $r = q(
- "SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `moderated` = 0 AND `uid` = %d
- ORDER BY `created` DESC LIMIT 1",
- dbesc($item["parent-uri"]),
- intval($importer["uid"])
- );
- if (DBM::is_result($r)) {
- q(
- "UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
- intval($r[0]["id"])
- );
- }
- }
+
// if this is a relayed delete, propagate it to other recipients
if ($entrytype == DFRN_REPLY_RC) {
$arr["object"] = self::constructNewFriendObject($contact);
- $arr["last-child"] = 1;
-
$user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]);
$arr["allow_cid"] = $user["allow_cid"];
$header["contact-id"] = $contact["id"];
- if (!strlen($contact["notify"])) {
- // one way feed - no remote comment ability
- $header["last-child"] = 0;
- }
-
if (!is_object($entries)) {
logger("There are no entries in this feed.", LOGGER_DEBUG);
return;
$stored_item = item_store($datarray);
- $condition = ['parent-uri' => $datarray['parent-uri'], 'uid' => $importer_uid];
- dba::update('item', ['last-child' => false], $condition);
-
- dba::update('item', ['last-child' => true], ['id' => $stored_item]);
-
switch ($mailconf['action']) {
case 0:
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", LOGGER_DEBUG);