aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-10-04 22:11:18 +0200
committerMario Vavti <mario@mariovavti.com>2017-10-04 22:11:18 +0200
commit6f88d5e92be06ad8fa61f900e8a4fb41ba54135e (patch)
tree525c291cd4611b0cbb481bb928d1c653cfa6a700
parent295ed07d40ea330ef438d9cad8fe3af8fd265507 (diff)
downloadvolse-hubzilla-6f88d5e92be06ad8fa61f900e8a4fb41ba54135e.tar.gz
volse-hubzilla-6f88d5e92be06ad8fa61f900e8a4fb41ba54135e.tar.bz2
volse-hubzilla-6f88d5e92be06ad8fa61f900e8a4fb41ba54135e.zip
introduce shared files notifications
-rw-r--r--Zotlabs/Module/Ping.php35
-rw-r--r--view/css/bootstrap-red.css4
-rwxr-xr-xview/tpl/nav.tpl20
3 files changed, 50 insertions, 9 deletions
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index 66ab1a386..3cda6a277 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -401,6 +401,39 @@ class Ping extends \Zotlabs\Web\Controller {
killme();
}
+ if(argc() > 1 && (argv(1) === 'files')) {
+ $result = array();
+
+ $r = q("SELECT item.created, xchan.xchan_name, xchan.xchan_url, xchan.xchan_photo_s FROM item
+ LEFT JOIN xchan on author_xchan = xchan_hash
+ WHERE item.verb = '%s'
+ AND item.obj_type = '%s'
+ AND item.uid = %d
+ AND item.owner_xchan != '%s'
+ AND item.item_unseen = 1",
+ dbesc(ACTIVITY_POST),
+ dbesc(ACTIVITY_OBJ_FILE),
+ intval(local_channel()),
+ dbesc($ob_hash)
+ );
+ if($r) {
+ foreach($r as $rr) {
+ $result[] = array(
+ 'notify_link' => z_root() . '/sharedwithme',
+ 'name' => $rr['xchan_name'],
+ 'url' => $rr['xchan_url'],
+ 'photo' => $rr['xchan_photo_s'],
+ 'when' => relative_date($rr['created']),
+ 'hclass' => ('notify-unseen'),
+ 'message' => t('shared a file with you')
+ );
+ }
+ }
+ logger('ping (files): ' . print_r($result, true), LOGGER_DATA);
+ echo json_encode(array('notify' => $result));
+ killme();
+ }
+
/**
* Normal ping - just the counts, no detail
*/
@@ -430,7 +463,7 @@ class Ping extends \Zotlabs\Web\Controller {
$result['files'] = intval($files[0]['total']);
}
- $t2 = dba_timer();
+ $t3 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$r = q("SELECT id, item_wall FROM item
diff --git a/view/css/bootstrap-red.css b/view/css/bootstrap-red.css
index e0018989d..fb6ea911e 100644
--- a/view/css/bootstrap-red.css
+++ b/view/css/bootstrap-red.css
@@ -7,6 +7,10 @@ nav .badge {
font-size: 0.75rem;
}
+nav .dropdown-menu {
+ min-width: 16rem;
+}
+
@media screen and (min-width: 767px) {
nav .badge {
top: 0px;
diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl
index 0d0b0b600..82cdc0dd0 100755
--- a/view/tpl/nav.tpl
+++ b/view/tpl/nav.tpl
@@ -162,6 +162,17 @@
</div>
</li>
{{/if}}
+ {{if $nav.files}}
+ <li class="nav-item dropdown files-button" style="display: none;">
+ <a class="nav-link" href="#" title="{{$nav.files.3}}" id="{{$nav.files.4}}" data-toggle="dropdown" rel="#nav-files-menu">
+ <i class="fa fa-fw fa-folder"></i>
+ <span class="badge badge-pill badge-danger files-update"></span>
+ </a>
+ <div id="nav-files-menu" class="dropdown-menu" rel="files">
+ {{$emptynotifications}}
+ </div>
+ </li>
+ {{/if}}
{{if $nav.login && !$userinfo}}
<li class="nav-item d-none d-md-flex">
<a class="nav-link" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}" data-toggle="modal" data-target="#nav-login">{{$nav.loginmenu.1.1}}</a>
@@ -177,14 +188,7 @@
<a class="nav-link" href="{{$nav.alogout.0}}" title="{{$nav.alogout.3}}" id="{{$nav.alogout.4}}">{{$nav.alogout.1}}</a>
</li>
{{/if}}
- {{if $nav.files}}
- <li class="nav-item dropdown files-button" style="display: none;">
- <a class="nav-link" href="{{$nav.files.0}}" title="{{$nav.files.3}}" id="{{$nav.files.4}}" rel="#nav-files-menu">
- <i class="fa fa-fw fa-folder"></i>
- <span class="badge badge-pill badge-primary files-update"></span>
- </a>
- </li>
- {{/if}}
+
{{if $nav.pubs}}
<li class="nav-item dropdown pubs-button" style="display: none;">
<a class="nav-link" href="{{$nav.pubs.0}}" title="{{$nav.pubs.3}}" id="{{$nav.pubs.4}}" rel="#nav-pubs-menu">