forked from friendica/friendica-addons
Merge pull request #1042 from MrPetovan/task/9515-item-insert-parent-uri
[various] Replace confusing uses of item.parent-uri with expected item.thr-parent
This commit is contained in:
commit
2f71df5429
|
@ -966,7 +966,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
|
||||||
$likedata['wall'] = 0;
|
$likedata['wall'] = 0;
|
||||||
$likedata['network'] = Protocol::PUMPIO;
|
$likedata['network'] = Protocol::PUMPIO;
|
||||||
$likedata['uri'] = Item::newURI($uid);
|
$likedata['uri'] = Item::newURI($uid);
|
||||||
$likedata['parent-uri'] = $orig_post["uri"];
|
$likedata['thr-parent'] = $orig_post['uri'];
|
||||||
$likedata['contact-id'] = $contactid;
|
$likedata['contact-id'] = $contactid;
|
||||||
$likedata['app'] = $post->generator->displayName;
|
$likedata['app'] = $post->generator->displayName;
|
||||||
$likedata['author-name'] = $post->actor->displayName;
|
$likedata['author-name'] = $post->actor->displayName;
|
||||||
|
@ -1137,7 +1137,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
||||||
$contact_id = $self[0]['id'];
|
$contact_id = $self[0]['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$postarray['parent-uri'] = $post->object->id;
|
$postarray['thr-parent'] = $post->object->id;
|
||||||
|
|
||||||
if (!$public) {
|
if (!$public) {
|
||||||
$postarray['private'] = 1;
|
$postarray['private'] = 1;
|
||||||
|
@ -1198,7 +1198,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
||||||
$reply->url = $post->object->inReplyTo->url;
|
$reply->url = $post->object->inReplyTo->url;
|
||||||
pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false);
|
pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false);
|
||||||
|
|
||||||
$postarray['parent-uri'] = $post->object->inReplyTo->id;
|
$postarray['thr-parent'] = $post->object->inReplyTo->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When there is no content there is no need to continue
|
// When there is no content there is no need to continue
|
||||||
|
@ -1277,7 +1277,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($post->object->objectType == "comment") && $threadcompletion) {
|
if (($post->object->objectType == "comment") && $threadcompletion) {
|
||||||
pumpio_fetchallcomments($a, $uid, $postarray['parent-uri']);
|
pumpio_fetchallcomments($a, $uid, $postarray['thr-parent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $top_item;
|
return $top_item;
|
||||||
|
|
|
@ -1104,24 +1104,15 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
$contactid = 0;
|
$contactid = 0;
|
||||||
|
|
||||||
if (!empty($content->in_reply_to_status_id)) {
|
if (!empty($content->in_reply_to_status_id)) {
|
||||||
|
$thr_parent = $hostname . "::" . $content->in_reply_to_status_id;
|
||||||
|
|
||||||
$parent = $hostname . "::" . $content->in_reply_to_status_id;
|
if (
|
||||||
|
Item::exists(['uri' => $thr_parent, 'uid' => $uid])
|
||||||
$fields = ['uri', 'parent-uri', 'parent'];
|
|| Item::exists(['extid' => $thr_parent, 'uid' => $uid])
|
||||||
$item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
|
) {
|
||||||
|
$postarray['thr-parent'] = $thr_parent;
|
||||||
if (!DBA::isResult($item)) {
|
|
||||||
$item = Item::selectFirst($fields, ['extid' => $parent, 'uid' => $uid]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DBA::isResult($item)) {
|
|
||||||
$postarray['thr-parent'] = $item['uri'];
|
|
||||||
$postarray['parent-uri'] = $item['parent-uri'];
|
|
||||||
$postarray['parent'] = $item['parent'];
|
|
||||||
$postarray['object-type'] = Activity\ObjectType::COMMENT;
|
$postarray['object-type'] = Activity\ObjectType::COMMENT;
|
||||||
} else {
|
} else {
|
||||||
$postarray['thr-parent'] = $postarray['uri'];
|
|
||||||
$postarray['parent-uri'] = $postarray['uri'];
|
|
||||||
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,7 +1136,6 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
// Don't create accounts of people who just comment something
|
// Don't create accounts of people who just comment something
|
||||||
$create_user = false;
|
$create_user = false;
|
||||||
} else {
|
} else {
|
||||||
$postarray['parent-uri'] = $postarray['uri'];
|
|
||||||
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1582,22 +1582,15 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
|
||||||
$contactid = 0;
|
$contactid = 0;
|
||||||
|
|
||||||
if ($post->in_reply_to_status_id_str != "") {
|
if ($post->in_reply_to_status_id_str != "") {
|
||||||
$parent = "twitter::" . $post->in_reply_to_status_id_str;
|
$thr_parent = "twitter::" . $post->in_reply_to_status_id_str;
|
||||||
|
|
||||||
$fields = ['uri', 'parent-uri', 'parent'];
|
if (
|
||||||
$parent_item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
|
Item::exists(['uri' => $thr_parent, 'uid' => $uid])
|
||||||
if (!DBA::isResult($parent_item)) {
|
|| Item::exists(['extid' => $thr_parent, 'uid' => $uid])
|
||||||
$parent_item = Item::selectFirst($fields, ['extid' => $parent, 'uid' => $uid]);
|
) {
|
||||||
}
|
$postarray['thr-parent'] = $thr_parent;
|
||||||
|
|
||||||
if (DBA::isResult($parent_item)) {
|
|
||||||
$postarray['thr-parent'] = $parent_item['uri'];
|
|
||||||
$postarray['parent-uri'] = $parent_item['parent-uri'];
|
|
||||||
$postarray['parent'] = $parent_item['parent'];
|
|
||||||
$postarray['object-type'] = Activity\ObjectType::COMMENT;
|
$postarray['object-type'] = Activity\ObjectType::COMMENT;
|
||||||
} else {
|
} else {
|
||||||
$postarray['thr-parent'] = $postarray['uri'];
|
|
||||||
$postarray['parent-uri'] = $postarray['uri'];
|
|
||||||
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1622,7 +1615,6 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
|
||||||
// Don't create accounts of people who just comment something
|
// Don't create accounts of people who just comment something
|
||||||
$create_user = false;
|
$create_user = false;
|
||||||
} else {
|
} else {
|
||||||
$postarray['parent-uri'] = $postarray['uri'];
|
|
||||||
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1710,9 +1702,6 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
|
||||||
$postarray['verb'] = Activity::ANNOUNCE;
|
$postarray['verb'] = Activity::ANNOUNCE;
|
||||||
$postarray['gravity'] = GRAVITY_ACTIVITY;
|
$postarray['gravity'] = GRAVITY_ACTIVITY;
|
||||||
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
$postarray['object-type'] = Activity\ObjectType::NOTE;
|
||||||
|
|
||||||
$postarray['thr-parent'] = $retweet['uri'];
|
|
||||||
$postarray['parent-uri'] = $retweet['uri'];
|
|
||||||
} else {
|
} else {
|
||||||
$retweet['source'] = $postarray['source'];
|
$retweet['source'] = $postarray['source'];
|
||||||
$retweet['private'] = $postarray['private'];
|
$retweet['private'] = $postarray['private'];
|
||||||
|
@ -1930,7 +1919,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
||||||
|
|
||||||
$notify = false;
|
$notify = false;
|
||||||
|
|
||||||
if (($postarray['uri'] == $postarray['parent-uri']) && ($postarray['author-link'] == $postarray['owner-link'])) {
|
if (($postarray['uri'] == $postarray['thr-parent']) && ($postarray['author-link'] == $postarray['owner-link'])) {
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $postarray['contact-id'], 'self' => false]);
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$notify = Item::isRemoteSelf($contact, $postarray);
|
$notify = Item::isRemoteSelf($contact, $postarray);
|
||||||
|
|
Loading…
Reference in a new issue