further progress on new network/home notifications
This commit is contained in:
parent
dd428cf4fc
commit
59ea856311
@ -1158,6 +1158,7 @@ function item_store($arr,$force_parent = false) {
|
|||||||
$arr['item_restrict'] = ((x($arr,'item_restrict')) ? intval($arr['item_restrict']) : 0 );
|
$arr['item_restrict'] = ((x($arr,'item_restrict')) ? intval($arr['item_restrict']) : 0 );
|
||||||
$arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
|
$arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
|
||||||
|
|
||||||
|
$arr['item_flags'] = $arr['item_flags'] | ITEM_UNSEEN;
|
||||||
|
|
||||||
$arr['thr_parent'] = $arr['parent_uri'];
|
$arr['thr_parent'] = $arr['parent_uri'];
|
||||||
if($arr['parent_uri'] === $arr['uri']) {
|
if($arr['parent_uri'] === $arr['uri']) {
|
||||||
|
@ -5,7 +5,7 @@ function format_notification($item) {
|
|||||||
|
|
||||||
$ret = '';
|
$ret = '';
|
||||||
|
|
||||||
return array();
|
// return array();
|
||||||
|
|
||||||
|
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
@ -28,13 +28,13 @@ return array();
|
|||||||
// convert this logic into a json array just like the system notifications
|
// convert this logic into a json array just like the system notifications
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'notify_link' => $a->get_baseurl() . '/notify/view/' . $zz['id'],
|
'notify_link' => z_root() . '/notify/view_item/' . $item['id'],
|
||||||
'name' => $zz['name'],
|
'name' => $item['author']['xchan_name'],
|
||||||
'url' => $zz['url'],
|
'url' => $item['author']['xchan_url'],
|
||||||
'photo' => $zz['photo'],
|
'photo' => $item['author']['xchan_photo_s'],
|
||||||
'when' => relative_date($zz['date']),
|
'when' => relative_date($item['created']),
|
||||||
'class' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
|
'class' => (($item['item_flags'] & ITEM_UNSEEN) ? 'notify-unseen' : 'notify-seen'),
|
||||||
'message' => strip_tags(bbcode($zz['msg']))
|
'message' => strip_tags(bbcode($itemem_text))
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
12
mod/ping.php
12
mod/ping.php
@ -93,23 +93,23 @@ function ping_init(&$a) {
|
|||||||
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
|
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
dbg(1);
|
||||||
$r = q("SELECT id, item_restrict, item_flags FROM item
|
$r = q("SELECT * FROM item
|
||||||
WHERE item_restrict = %d and item_flags & %d and `item`.`uid` = %d",
|
WHERE item_restrict = %d and ( item_flags & %d ) and uid = %d",
|
||||||
intval(ITEM_VISIBLE),
|
intval(ITEM_VISIBLE),
|
||||||
intval(ITEM_UNSEEN),
|
intval(ITEM_UNSEEN),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
dbg(0);
|
||||||
if($r) {
|
if($r) {
|
||||||
xchan_query($r);
|
xchan_query($r);
|
||||||
foreach($r as $item) {
|
foreach($r as $item) {
|
||||||
if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_HOME)))
|
if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_WALL)))
|
||||||
continue;
|
continue;
|
||||||
$result[] = format_notification($item);
|
$result[] = format_notification($item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger('ping: ' . print_r($result,true));
|
||||||
echo json_encode(array( argv(1) => $result));
|
echo json_encode(array( argv(1) => $result));
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user