1
0
Fork 0

Move Notify::TYPE_MAIL

This commit is contained in:
nupplaPhil 2020-02-04 22:10:19 +01:00
parent e6fb044e60
commit 9435cc4b88
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
8 changed files with 11 additions and 8 deletions

View file

@ -140,7 +140,6 @@ define('MAX_LIKERS', 75);
* Email notification options
* @{
*/
define('NOTIFY_MAIL', 16);
define('NOTIFY_SUGGEST', 32);
define('NOTIFY_PROFILE', 64);
define('NOTIFY_TAGSELF', 128);

View file

@ -102,7 +102,7 @@ function notification($params)
$hsitelink = '';
$itemlink = '';
if ($params['type'] == NOTIFY_MAIL) {
if ($params['type'] == Notify\Type::MAIL) {
$itemlink = $siteurl.'/message/'.$params['item']['id'];
$params["link"] = $itemlink;

View file

@ -13,6 +13,7 @@ use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Mail;
use Friendica\Model\Notify\Type;
use Friendica\Module\Security\Login;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
@ -338,10 +339,10 @@ function message_content(App $a)
if ($message['convid']) {
// Clear Diaspora private message notifications
DBA::update('notify', ['seen' => 1], ['type' => NOTIFY_MAIL, 'parent' => $message['convid'], 'uid' => local_user()]);
DBA::update('notify', ['seen' => 1], ['type' => Type::MAIL, 'parent' => $message['convid'], 'uid' => local_user()]);
}
// Clear DFRN private message notifications
DBA::update('notify', ['seen' => 1], ['type' => NOTIFY_MAIL, 'parent' => $message['parent-uri'], 'uid' => local_user()]);
DBA::update('notify', ['seen' => 1], ['type' => Type::MAIL, 'parent' => $message['parent-uri'], 'uid' => local_user()]);
} else {
$messages = false;
}

View file

@ -405,7 +405,7 @@ function ping_get_notifications($uid)
AND $seensql `notify`.`seen` ORDER BY `notify`.`date` $order LIMIT %d, 50",
intval($uid),
intval(Type::INTRO),
intval(NOTIFY_MAIL),
intval(Type::MAIL),
intval($offset)
);

View file

@ -1234,7 +1234,7 @@ function settings_content(App $a)
'$notify2' => ['notify2', DI::l10n()->t('Your introductions are confirmed'), ($notify & Type::CONFIRM), Type::CONFIRM, ''],
'$notify3' => ['notify3', DI::l10n()->t('Someone writes on your profile wall'), ($notify & Type::WALL), Type::WALL, ''],
'$notify4' => ['notify4', DI::l10n()->t('Someone writes a followup comment'), ($notify & Type::COMMENT), Type::COMMENT, ''],
'$notify5' => ['notify5', DI::l10n()->t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''],
'$notify5' => ['notify5', DI::l10n()->t('You receive a private message'), ($notify & Type::MAIL), Type::MAIL, ''],
'$notify6' => ['notify6', DI::l10n()->t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''],
'$notify7' => ['notify7', DI::l10n()->t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''],
'$notify8' => ['notify8', DI::l10n()->t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''],

View file

@ -10,6 +10,7 @@ use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\DI;
use Friendica\Database\DBA;
use Friendica\Model\Notify\Type;
use Friendica\Network\Probe;
use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
@ -68,7 +69,7 @@ class Mail
// send notifications.
$notif_params = [
'type' => NOTIFY_MAIL,
'type' => Type::MAIL,
'notify_flags' => $user['notify-flags'],
'language' => $user['language'],
'to_name' => $user['username'],

View file

@ -15,4 +15,6 @@ class Type
const WALL = 4;
/** @var int Notification about a followup comment */
const COMMENT = 8;
/** @var int Notification about a private message */
const MAIL = 16;
}

View file

@ -112,7 +112,7 @@ class Delegation extends BaseModule
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->user['nickname']);
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Type::INTRO, NOTIFY_MAIL];
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Type::INTRO, Type::MAIL];
$params = ['distinct' => true, 'expression' => 'parent'];
$notifications = DBA::count('notify', $condition, $params);