aboutsummaryrefslogtreecommitdiffstats
path: root/mod/like.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/like.php')
-rwxr-xr-xmod/like.php32
1 files changed, 19 insertions, 13 deletions
diff --git a/mod/like.php b/mod/like.php
index 7c3df98ba..f617391a1 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -49,6 +49,7 @@ function like_content(&$a) {
$item = $r[0];
$owner_uid = $item['uid'];
+ $owner_aid = $item['aid'];
if(! perm_is_allowed($owner_uid,$observer['xchan_hash'],'post_comments')) {
notice( t('Permission denied') . EOL);
@@ -78,7 +79,7 @@ function like_content(&$a) {
dbesc($activity),
dbesc($observer['xchan_hash']),
intval($item_id),
- dbesc($item['uri'])
+ dbesc($item['mid'])
);
if($r) {
$like_item = $r[0];
@@ -97,22 +98,23 @@ function like_content(&$a) {
- $uri = item_message_id();
+ $mid = item_message_id();
$post_type = (($item['resource_type'] === 'photo') ? $t('photo') : t('status'));
- $links = array(array('rel' => 'alternate','type' => 'text/html',
- 'href' => z_root() . '/display/' . $item['uri']));
+ $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink']));
$objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
$body = $item['body'];
$obj = json_encode(array(
'type' => $objtype,
- 'id' => $item['uri'],
+ 'id' => $item['mid'],
'link' => $links,
'title' => $item['title'],
'content' => $item['body'],
+ 'created' => $item['created'],
+ 'edited' => $item['edited'],
'author' => array(
'name' => $item_author['xchan_name'],
'address' => $item_author['xchan_addr'],
@@ -124,6 +126,9 @@ function like_content(&$a) {
),
));
+ if(! ($item['item_flags'] & ITEM_THREAD_TOP))
+ $post_type = 'comment';
+
if($verb === 'like')
$bodyverb = t('%1$s likes %2$s\'s %3$s');
if($verb === 'dislike')
@@ -132,28 +137,29 @@ function like_content(&$a) {
if(! isset($bodyverb))
return;
- $item_flags = ITEM_ORIGIN;
+ $item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN;
if($item['item_flags'] & ITEM_WALL)
$item_flags |= ITEM_WALL;
$arr = array();
- $arr['uri'] = $uri;
+ $arr['mid'] = $mid;
+ $arr['aid'] = $owner_aid;
$arr['uid'] = $owner_uid;
$arr['item_flags'] = $item_flags;
$arr['parent'] = $item['id'];
- $arr['parent_uri'] = $item['uri'];
- $arr['thr_parent'] = $item['uri'];
+ $arr['parent_mid'] = $item['mid'];
+ $arr['thr_parent'] = $item['mid'];
$arr['owner_xchan'] = $thread_owner['xchan_hash'];
$arr['author_xchan'] = $observer['xchan_hash'];
- $ulink = '[url=' . $item_owner['xchan_url'] . ']' . $item_owner['xchan_name'] . '[/url]';
- $alink = '[url=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/url]';
- $plink = '[url=' . $a->get_baseurl() . '/display/' . $item['uri'] . ']' . $post_type . '[/url]';
+ $ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
+ $alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
+ $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
- $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
+ $arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink );
$arr['verb'] = $activity;
$arr['obj_type'] = $objtype;