aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRedMatrix <info@friendica.com>2014-12-31 10:21:38 +1100
committerRedMatrix <info@friendica.com>2014-12-31 10:21:38 +1100
commit4a82967639e662821de177e3bd829b735b4eb24e (patch)
tree0fd82236b54cfc90083ac0a2e2bf0a3a56fc7b18
parent43671a0a323afa758df56c06822ce3c46da026df (diff)
parente6a3ea2c95579a33a5c009aa223a899c8f2aeeb8 (diff)
downloadvolse-hubzilla-4a82967639e662821de177e3bd829b735b4eb24e.tar.gz
volse-hubzilla-4a82967639e662821de177e3bd829b735b4eb24e.tar.bz2
volse-hubzilla-4a82967639e662821de177e3bd829b735b4eb24e.zip
Merge pull request #791 from pafcu/notifications
Improved notifications
-rw-r--r--include/enotify.php17
-rw-r--r--mod/settings.php5
-rw-r--r--view/theme/redbasic/css/style.css14
-rwxr-xr-xview/tpl/settings.tpl2
4 files changed, 36 insertions, 2 deletions
diff --git a/include/enotify.php b/include/enotify.php
index f3eb80117..3fef3ba0a 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -357,9 +357,21 @@ function notification($params) {
// create notification entry in DB
+ $seen = 0;
+
+ // Mark some notifications as seen right away
+ // Note! The notification have to be created, because they are used to send emails
+ // So easiest solution to hide them from Notices is to mark them as seen right away.
+ // Another option would be to not add them to the DB, and change how emails are handled (probably would be better that way)
+ $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
+ if(!$always_show_in_notices) {
+ if(($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) {
+ $seen = 1;
+ }
+ }
- $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,type,verb,otype)
- values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,'%s','%s')",
+ $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,seen,type,verb,otype)
+ values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')",
dbesc($datarray['hash']),
dbesc($datarray['name']),
dbesc($datarray['url']),
@@ -369,6 +381,7 @@ function notification($params) {
intval($datarray['uid']),
dbesc($datarray['link']),
dbesc($datarray['parent']),
+ intval($seen),
intval($datarray['type']),
dbesc($datarray['verb']),
dbesc($datarray['otype'])
diff --git a/mod/settings.php b/mod/settings.php
index ea7b2ba06..be6f2cfb9 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -449,6 +449,8 @@ function settings_post(&$a) {
if(x($_POST,'vnotify11'))
$vnotify += intval($_POST['vnotify11']);
+ $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
+
$channel = $a->get_channel();
$err = '';
@@ -478,6 +480,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','blocktags',$blocktags);
set_pconfig(local_user(),'system','channel_menu',$channel_menu);
set_pconfig(local_user(),'system','vnotify',$vnotify);
+ set_pconfig(local_user(),'system','always_show_in_notices',$always_show_in_notices);
set_pconfig(local_user(),'system','evdays',$evdays);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
@@ -995,6 +998,7 @@ function settings_content(&$a) {
$permissions_role = get_pconfig(local_user(),'system','permissions_role');
$permissions_set = (($permissions_role && $permissions_role != 'custom') ? true : false);
$vnotify = get_pconfig(local_user(),'system','vnotify');
+ $always_show_in_notices = get_pconfig(local_user(),'system','always_show_in_notices');
if($vnotify === false)
$vnotify = (-1);
@@ -1080,6 +1084,7 @@ function settings_content(&$a) {
'$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended')),
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended')),
'$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, ''),
+ '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, ''),
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index fccf4ec87..50b21add9 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -1941,6 +1941,20 @@ nav .badge:hover {
background-color: #999;
}
+nav .badge.home-update,
+nav .badge.notify-update,
+nav .badge.intro-update,
+nav .badge.mail-update {
+ background-color:#C9302C;
+}
+
+nav .badge.home-update:hover,
+nav .badge.notify-update:hover,
+nav .badge.intro-update:hover,
+nav .badge.mail-update:hover {
+ background-color:#D9534F;
+}
+
.dropdown-menu {
font-size: $body_font_size;
border-radius: $radiuspx;
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index 7fa52677b..47d85d8e4 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -113,6 +113,8 @@
{{include file="field_intcheckbox.tpl" field=$vnotify7}}
{{include file="field_intcheckbox.tpl" field=$vnotify8}}
{{include file="field_intcheckbox.tpl" field=$vnotify9}}
+{{include file="field_intcheckbox.tpl" field=$vnotify11}}
+{{include file="field_intcheckbox.tpl" field=$always_show_in_notices}}
{{*include file="field_intcheckbox.tpl" field=$vnotify11*}}
</div>