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:
Michael Vogel 2020-11-19 22:36:03 +01:00 committed by GitHub
commit 2f71df5429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 38 deletions

View File

@ -966,7 +966,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
$likedata['wall'] = 0;
$likedata['network'] = Protocol::PUMPIO;
$likedata['uri'] = Item::newURI($uid);
$likedata['parent-uri'] = $orig_post["uri"];
$likedata['thr-parent'] = $orig_post['uri'];
$likedata['contact-id'] = $contactid;
$likedata['app'] = $post->generator->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'];
}
$postarray['parent-uri'] = $post->object->id;
$postarray['thr-parent'] = $post->object->id;
if (!$public) {
$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;
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
@ -1277,7 +1277,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
}
if (($post->object->objectType == "comment") && $threadcompletion) {
pumpio_fetchallcomments($a, $uid, $postarray['parent-uri']);
pumpio_fetchallcomments($a, $uid, $postarray['thr-parent']);
}
return $top_item;

View File

@ -1104,24 +1104,15 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$contactid = 0;
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;
$fields = ['uri', 'parent-uri', 'parent'];
$item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
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'];
if (
Item::exists(['uri' => $thr_parent, 'uid' => $uid])
|| Item::exists(['extid' => $thr_parent, 'uid' => $uid])
) {
$postarray['thr-parent'] = $thr_parent;
$postarray['object-type'] = Activity\ObjectType::COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
$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
$create_user = false;
} else {
$postarray['parent-uri'] = $postarray['uri'];
$postarray['object-type'] = Activity\ObjectType::NOTE;
}

View File

@ -1582,22 +1582,15 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
$contactid = 0;
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'];
$parent_item = Item::selectFirst($fields, ['uri' => $parent, 'uid' => $uid]);
if (!DBA::isResult($parent_item)) {
$parent_item = Item::selectFirst($fields, ['extid' => $parent, 'uid' => $uid]);
}
if (DBA::isResult($parent_item)) {
$postarray['thr-parent'] = $parent_item['uri'];
$postarray['parent-uri'] = $parent_item['parent-uri'];
$postarray['parent'] = $parent_item['parent'];
if (
Item::exists(['uri' => $thr_parent, 'uid' => $uid])
|| Item::exists(['extid' => $thr_parent, 'uid' => $uid])
) {
$postarray['thr-parent'] = $thr_parent;
$postarray['object-type'] = Activity\ObjectType::COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
$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
$create_user = false;
} else {
$postarray['parent-uri'] = $postarray['uri'];
$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['gravity'] = GRAVITY_ACTIVITY;
$postarray['object-type'] = Activity\ObjectType::NOTE;
$postarray['thr-parent'] = $retweet['uri'];
$postarray['parent-uri'] = $retweet['uri'];
} else {
$retweet['source'] = $postarray['source'];
$retweet['private'] = $postarray['private'];
@ -1930,7 +1919,7 @@ function twitter_fetchhometimeline(App $a, $uid)
$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]);
if (DBA::isResult($contact)) {
$notify = Item::isRemoteSelf($contact, $postarray);