Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge

This commit is contained in:
zotlabs 2018-02-14 15:37:35 -08:00
commit c11ebd12d5
3 changed files with 30 additions and 9 deletions

View File

@ -130,7 +130,7 @@ class Enotify {
} }
if ($params['type'] == NOTIFY_COMMENT) { if ($params['type'] == NOTIFY_COMMENT) {
// logger("notification: params = " . print_r($params, true), LOGGER_DEBUG); //logger("notification: params = " . print_r($params, true), LOGGER_DEBUG);
$moderated = (($params['item']['item_blocked'] == ITEM_MODERATED) ? true : false); $moderated = (($params['item']['item_blocked'] == ITEM_MODERATED) ? true : false);
@ -138,7 +138,7 @@ class Enotify {
$action = 'commented on'; $action = 'commented on';
if(array_key_exists('item',$params) && (! visible_activity($params['item']))) { if(array_key_exists('item',$params) && in_array($params['item']['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
if(! $always_show_in_notices) { if(! $always_show_in_notices) {
logger('notification: not a visible activity. Ignoring.'); logger('notification: not a visible activity. Ignoring.');
@ -146,10 +146,10 @@ class Enotify {
return; return;
} }
if(activity_match($params['item']['verb'], ACTIVITY_LIKE)) if(activity_match($params['verb'], ACTIVITY_LIKE))
$action = 'liked'; $action = 'liked';
if(activity_match($params['item']['verb'], ACTIVITY_DISLIKE)) if(activity_match($params['verb'], ACTIVITY_DISLIKE))
$action = 'disliked'; $action = 'disliked';
} }
@ -212,7 +212,7 @@ class Enotify {
// "your post" // "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
$dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%3$s]your %5$s[/zrl]'), $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]your %5$s[/zrl]'),
$recip['channel_name'], $recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$action, $action,

View File

@ -268,7 +268,18 @@ class Ping extends \Zotlabs\Web\Controller {
$mid = basename($tt['link']); $mid = basename($tt['link']);
$b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid)); if(in_array($tt['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
// we need the thread parent
$r = q("select thr_parent from item where mid = '%s' and uid = %d limit 1",
dbesc($mid),
intval(local_channel())
);
$b64mid = ((strpos($r[0]['thr_parent'], 'b64.' === 0)) ? $r[0]['thr_parent'] : 'b64.' . base64url_encode($r[0]['thr_parent']));
}
else {
$b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid));
}
$notifs[] = array( $notifs[] = array(
'notify_link' => z_root() . '/notify/view/' . $tt['id'], 'notify_link' => z_root() . '/notify/view/' . $tt['id'],

View File

@ -2327,6 +2327,16 @@ function send_status_notifications($post_id,$item) {
$parent = 0; $parent = 0;
if(array_key_exists('verb',$item) && (activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE))) {
$r = q("select id from item where mid = '%s' and uid = %d limit 1",
dbesc($item['thr_parent']),
intval($item['uid'])
);
$thr_parent_id = $r[0]['id'];
}
$r = q("select channel_hash from channel where channel_id = %d limit 1", $r = q("select channel_hash from channel where channel_id = %d limit 1",
intval($item['uid']) intval($item['uid'])
); );
@ -2392,10 +2402,10 @@ function send_status_notifications($post_id,$item) {
'to_xchan' => $r[0]['channel_hash'], 'to_xchan' => $r[0]['channel_hash'],
'item' => $item, 'item' => $item,
'link' => $link, 'link' => $link,
'verb' => ACTIVITY_POST, 'verb' => $item['verb'],
'otype' => 'item', 'otype' => 'item',
'parent' => $parent, 'parent' => $thr_parent_id ? $thr_parent_id : $parent,
'parent_mid' => $item['parent_mid'] 'parent_mid' => $thr_parent_id ? $item['thr_parent'] : $item['parent_mid']
)); ));
} }