aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-11-29 20:46:45 -0800
committerfriendica <info@friendica.com>2012-11-29 20:46:45 -0800
commit59ea85631199c126bc74af591f63ddf6dc1b36b8 (patch)
tree21e547639a5bcc186a9104ccd6de9bfe97f8014d
parentdd428cf4fc1ec043eea99e8d909cc21c5e214d26 (diff)
downloadvolse-hubzilla-59ea85631199c126bc74af591f63ddf6dc1b36b8.tar.gz
volse-hubzilla-59ea85631199c126bc74af591f63ddf6dc1b36b8.tar.bz2
volse-hubzilla-59ea85631199c126bc74af591f63ddf6dc1b36b8.zip
further progress on new network/home notifications
-rwxr-xr-xinclude/items.php1
-rw-r--r--include/notify.php16
-rw-r--r--mod/ping.php12
3 files changed, 15 insertions, 14 deletions
diff --git a/include/items.php b/include/items.php
index a6ecbbb88..a0cc64fc2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -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_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
+ $arr['item_flags'] = $arr['item_flags'] | ITEM_UNSEEN;
$arr['thr_parent'] = $arr['parent_uri'];
if($arr['parent_uri'] === $arr['uri']) {
diff --git a/include/notify.php b/include/notify.php
index a551444ee..9517e06dc 100644
--- a/include/notify.php
+++ b/include/notify.php
@@ -5,7 +5,7 @@ function format_notification($item) {
$ret = '';
-return array();
+// return array();
require_once('include/conversation.php');
@@ -28,13 +28,13 @@ return array();
// convert this logic into a json array just like the system notifications
return array(
- 'notify_link' => $a->get_baseurl() . '/notify/view/' . $zz['id'],
- 'name' => $zz['name'],
- 'url' => $zz['url'],
- 'photo' => $zz['photo'],
- 'when' => relative_date($zz['date']),
- 'class' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
- 'message' => strip_tags(bbcode($zz['msg']))
+ 'notify_link' => z_root() . '/notify/view_item/' . $item['id'],
+ 'name' => $item['author']['xchan_name'],
+ 'url' => $item['author']['xchan_url'],
+ 'photo' => $item['author']['xchan_photo_s'],
+ 'when' => relative_date($item['created']),
+ 'class' => (($item['item_flags'] & ITEM_UNSEEN) ? 'notify-unseen' : 'notify-seen'),
+ 'message' => strip_tags(bbcode($itemem_text))
);
}
diff --git a/mod/ping.php b/mod/ping.php
index b1bb569f2..cdc18a303 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -93,23 +93,23 @@ function ping_init(&$a) {
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();
-
- $r = q("SELECT id, item_restrict, item_flags FROM item
- WHERE item_restrict = %d and item_flags & %d and `item`.`uid` = %d",
+dbg(1);
+ $r = q("SELECT * FROM item
+ WHERE item_restrict = %d and ( item_flags & %d ) and uid = %d",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
intval(local_user())
);
-
+dbg(0);
if($r) {
xchan_query($r);
foreach($r as $item) {
- if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_HOME)))
+ if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_WALL)))
continue;
$result[] = format_notification($item);
}
}
-
+ logger('ping: ' . print_r($result,true));
echo json_encode(array( argv(1) => $result));
killme();