aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-31 18:59:45 -0700
committerfriendica <info@friendica.com>2012-05-31 18:59:45 -0700
commit598fc1ae2104970f2ba91fbf64aa1754aab6322e (patch)
tree4bdd05d9e2b0fe01774626870100c4abb3c34031
parentf0cf0ebb485432b444b1d85843385ebfda0260fd (diff)
parentd5116689af17a6e5f941180204310a03a52fea29 (diff)
downloadvolse-hubzilla-598fc1ae2104970f2ba91fbf64aa1754aab6322e.tar.gz
volse-hubzilla-598fc1ae2104970f2ba91fbf64aa1754aab6322e.tar.bz2
volse-hubzilla-598fc1ae2104970f2ba91fbf64aa1754aab6322e.zip
Merge pull request #319 from fermionic/fix-diaspora-parent-query
query using both `id` and `parent`
-rw-r--r--include/diaspora.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index 3f2cdf8e4..e32b6cb06 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -2055,7 +2055,11 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
$theiraddr = $contact['addr'];
- $p = q("select guid from item where parent = %d limit 1",
+ // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
+ // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
+ // The only item with `parent` and `id` as the parent id is the parent item.
+ $p = q("select guid from item where parent = %d and id = %d limit 1",
+ $item['parent'],
$item['parent']
);
if(count($p))
@@ -2111,7 +2115,11 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
$theiraddr = $contact['addr'];
- $p = q("select guid from item where parent = %d limit 1",
+ // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
+ // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
+ // The only item with `parent` and `id` as the parent id is the parent item.
+ $p = q("select guid from item where parent = %d and id = %d limit 1",
+ $item['parent'],
$item['parent']
);
if(count($p))