From: nupplaPhil Date: Tue, 4 Feb 2020 21:03:45 +0000 (+0100) Subject: Move Notify::TYPE_INTRO X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cfd50f9abbbab2d32808886d3bb22ca0ead3da95;p=friendica.git Move Notify::TYPE_INTRO --- diff --git a/boot.php b/boot.php index 3852c3279a..f708ff8820 100644 --- a/boot.php +++ b/boot.php @@ -140,7 +140,6 @@ define('MAX_LIKERS', 75); * Email notification options * @{ */ -define('NOTIFY_INTRO', 1); define('NOTIFY_CONFIRM', 2); define('NOTIFY_WALL', 4); define('NOTIFY_COMMENT', 8); diff --git a/include/enotify.php b/include/enotify.php index 9f18a472d2..141fd36757 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -276,7 +276,7 @@ function notification($params) $hsitelink = sprintf($sitelink, ''.$sitename.''); } - if ($params['type'] == NOTIFY_INTRO) { + if ($params['type'] == Notify\Type::INTRO) { $itemlink = $params['link']; $subject = $l10n->t('[Friendica:Notify] Introduction received'); diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index d8ad2bd3a5..bf1fbe3c90 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -23,6 +23,7 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Group; +use Friendica\Model\Notify\Type; use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Module\Security\Login; @@ -552,7 +553,7 @@ function dfrn_request_content(App $a) if (!$auto_confirm) { notification([ - 'type' => NOTIFY_INTRO, + 'type' => Type::INTRO, 'notify_flags' => $r[0]['notify-flags'], 'language' => $r[0]['language'], 'to_name' => $r[0]['username'], diff --git a/mod/ping.php b/mod/ping.php index 70c580d3d3..580d82a95f 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -13,6 +13,7 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; +use Friendica\Model\Notify\Type; use Friendica\Util\DateTimeFormat; use Friendica\Util\Temporal; use Friendica\Util\Proxy as ProxyUtils; @@ -403,7 +404,7 @@ function ping_get_notifications($uid) AND NOT (`notify`.`type` IN (%d, %d)) AND $seensql `notify`.`seen` ORDER BY `notify`.`date` $order LIMIT %d, 50", intval($uid), - intval(NOTIFY_INTRO), + intval(Type::INTRO), intval(NOTIFY_MAIL), intval($offset) ); diff --git a/mod/settings.php b/mod/settings.php index 277470ad5b..3a9d911042 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -19,6 +19,7 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Group; +use Friendica\Model\Notify\Type; use Friendica\Model\User; use Friendica\Module\Security\Login; use Friendica\Protocol\Email; @@ -1229,7 +1230,7 @@ function settings_content(App $a) '$h_not' => DI::l10n()->t('Notification Settings'), '$lbl_not' => DI::l10n()->t('Send a notification email when:'), - '$notify1' => ['notify1', DI::l10n()->t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''], + '$notify1' => ['notify1', DI::l10n()->t('You receive an introduction'), ($notify & Type::INTRO), NOTIFY_INTRO, ''], '$notify2' => ['notify2', DI::l10n()->t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''], '$notify3' => ['notify3', DI::l10n()->t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''], '$notify4' => ['notify4', DI::l10n()->t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''], diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 3897f821b7..051f94d3ef 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -14,6 +14,7 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Model\Notify\Type; use Friendica\Network\Probe; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityPub; @@ -2628,11 +2629,11 @@ class Contact Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']); - if (($user['notify-flags'] & NOTIFY_INTRO) && + if (($user['notify-flags'] & Type::INTRO) && in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL])) { notification([ - 'type' => NOTIFY_INTRO, + 'type' => Type::INTRO, '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 new file mode 100644 index 0000000000..5f34e1aa39 --- /dev/null +++ b/src/Model/Notify/Type.php @@ -0,0 +1,12 @@ +user['nickname']); - $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], NOTIFY_INTRO, NOTIFY_MAIL]; + $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Type::INTRO, NOTIFY_MAIL]; $params = ['distinct' => true, 'expression' => 'parent']; $notifications = DBA::count('notify', $condition, $params);