mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 06:15:11 +00:00
Merge pull request #791 from pafcu/notifications
Improved notifications
This commit is contained in:
commit
4a82967639
4 changed files with 36 additions and 2 deletions
|
@ -357,9 +357,21 @@ function notification($params) {
|
|||
|
||||
|
||||
// create notification entry in DB
|
||||
$seen = 0;
|
||||
|
||||
$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')",
|
||||
// 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,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'])
|
||||
|
|
|
@ -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')),
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue