diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-08-26 20:20:41 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-08-26 20:20:41 -0700 |
commit | d1c23477dfb0ee48cf652d6e63969ed5a3809b18 (patch) | |
tree | df161d7f8150cfb2af87b9be279ab1c719c39070 | |
parent | 8fb1356623f9a2b6089e97103b593158e67c8676 (diff) | |
download | volse-hubzilla-d1c23477dfb0ee48cf652d6e63969ed5a3809b18.tar.gz volse-hubzilla-d1c23477dfb0ee48cf652d6e63969ed5a3809b18.tar.bz2 volse-hubzilla-d1c23477dfb0ee48cf652d6e63969ed5a3809b18.zip |
support likes on comments with diaspora owner by sending as activity
-rwxr-xr-x | include/diaspora.php | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index 74a56dd79..61556fd9d 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2742,21 +2742,26 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) { // versions of Diaspora (i.e. Diaspora-pistos) support // likes on comments + + // That version is now dead so detect a "sublike" and + // just send it as an activity. + + $sublike = false; + + if($item['verb'] === ACTIVITY_LIKE && $item['thr_parent']) { - $p = q("select * from item where mid = '%s' limit 1", - dbesc($item['thr_parent']) - ); - } - else { - // 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 * from item where parent = %d and id = %d limit 1", - intval($item['parent']), - intval($item['parent']) - ); + $sublike = true; } + + // 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 * from item where parent = %d and id = %d limit 1", + intval($item['parent']), + intval($item['parent']) + ); + if($p) $parent = $p[0]; else { @@ -2771,12 +2776,12 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) { if( $item['item_restrict'] & ITEM_DELETED) { $relay_retract = true; - $target_type = ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment'); + $target_type = ( ($item['verb'] === ACTIVITY_LIKE && (! $sublike)) ? 'Like' : 'Comment'); $sql_sign_id = 'retract_iid'; $tpl = get_markup_template('diaspora_relayable_retraction.tpl'); } - elseif($item['verb'] === ACTIVITY_LIKE) { + elseif(($item['verb'] === ACTIVITY_LIKE) && (! $sublike)) { $like = true; $target_type = ( $parent['mid'] === $parent['parent_mid'] ? 'Post' : 'Comment'); |