diff --git a/boot.php b/boot.php index eafbc8da9..4c16f59d6 100644 --- a/boot.php +++ b/boot.php @@ -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); diff --git a/include/enotify.php b/include/enotify.php index 4c4e7e10d..ad141e1c4 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -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; diff --git a/mod/message.php b/mod/message.php index d1d3e89df..bba530ca5 100644 --- a/mod/message.php +++ b/mod/message.php @@ -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; } diff --git a/mod/ping.php b/mod/ping.php index 580d82a95..f91a1753c 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -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) ); diff --git a/mod/settings.php b/mod/settings.php index 363501852..7ae0f6479 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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, ''], diff --git a/src/Model/Mail.php b/src/Model/Mail.php index de351db4a..9735a795a 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -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'], diff --git a/src/Model/Notify/Type.php b/src/Model/Notify/Type.php index 440dde63e..fbc31da37 100644 --- a/src/Model/Notify/Type.php +++ b/src/Model/Notify/Type.php @@ -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; } diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index eb38f0289..b5e4c1a90 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -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);