mirror of
https://github.com/friendica/friendica
synced 2024-11-19 14:23:42 +00:00
Use constants
This commit is contained in:
parent
da33517a2d
commit
62701b49e1
2 changed files with 13 additions and 24 deletions
|
@ -31,6 +31,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Notification;
|
||||
use Friendica\Model\Post\UserNotification;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\Verb;
|
||||
|
@ -256,23 +257,23 @@ class Account extends BaseSettings
|
|||
$notify_type = 0;
|
||||
|
||||
if (!empty($request['notify_tagged'])) {
|
||||
$notify_type = $notify_type | 3;
|
||||
$notify_type = $notify_type | (UserNotification::TYPE_EXPLICIT_TAGGED + UserNotification::TYPE_IMPLICIT_TAGGED);
|
||||
}
|
||||
if (!empty($request['notify_direct_comment'])) {
|
||||
$notify_type = $notify_type | 72;
|
||||
$notify_type = $notify_type | (UserNotification::TYPE_DIRECT_COMMENT + UserNotification::TYPE_DIRECT_THREAD_COMMENT);
|
||||
}
|
||||
if (!empty($request['notify_thread_comment'])) {
|
||||
$notify_type = $notify_type | 4;
|
||||
$notify_type = $notify_type | UserNotification::TYPE_THREAD_COMMENT;
|
||||
}
|
||||
if (!empty($request['notify_comment_participation'])) {
|
||||
$notify_type = $notify_type | 16;
|
||||
$notify_type = $notify_type | UserNotification::TYPE_COMMENT_PARTICIPATION;
|
||||
}
|
||||
if (!empty($request['notify_activity_participation'])) {
|
||||
$notify_type = $notify_type | 32;
|
||||
$notify_type = $notify_type | UserNotification::TYPE_ACTIVITY_PARTICIPATION;
|
||||
}
|
||||
DI::pConfig()->set(local_user(), 'system', 'notify_type', $notify_type);
|
||||
|
||||
if (!($notify_type & 72)) {
|
||||
if (!($notify_type & (UserNotification::TYPE_DIRECT_COMMENT + UserNotification::TYPE_DIRECT_THREAD_COMMENT))) {
|
||||
$notify_like = false;
|
||||
$notify_announce = false;
|
||||
}
|
||||
|
@ -616,13 +617,13 @@ class Account extends BaseSettings
|
|||
'$notify8' => ['notify8', DI::l10n()->t('You are poked/prodded/etc. in a post'), ($notify & Notification\Type::POKE), Notification\Type::POKE, ''],
|
||||
|
||||
'$lbl_notify' => DI::l10n()->t('Create a desktop notification when:'),
|
||||
'$notify_tagged' => ['notify_tagged', DI::l10n()->t('Someone tagged you'), $notify_type & 3, ''],
|
||||
'$notify_direct_comment' => ['notify_direct_comment', DI::l10n()->t('Someone directly commented on your post'), $notify_type & 72, ''],
|
||||
'$notify_tagged' => ['notify_tagged', DI::l10n()->t('Someone tagged you'), $notify_type & (UserNotification::TYPE_EXPLICIT_TAGGED + UserNotification::TYPE_IMPLICIT_TAGGED), ''],
|
||||
'$notify_direct_comment' => ['notify_direct_comment', DI::l10n()->t('Someone directly commented on your post'), $notify_type & (UserNotification::TYPE_DIRECT_COMMENT + UserNotification::TYPE_DIRECT_THREAD_COMMENT), ''],
|
||||
'$notify_like' => ['notify_like', DI::l10n()->t('Someone liked your content'), DI::pConfig()->get(local_user(), 'system', 'notify_like'), DI::l10n()->t('Can only be enabled, when the direct comment notification is enabled.')],
|
||||
'$notify_announce' => ['notify_announce', DI::l10n()->t('Someone shared your content'), DI::pConfig()->get(local_user(), 'system', 'notify_announce'), DI::l10n()->t('Can only be enabled, when the direct comment notification is enabled.')],
|
||||
'$notify_thread_comment' => ['notify_thread_comment', DI::l10n()->t('Someone commented on your thread'), $notify_type & 4, ''],
|
||||
'$notify_comment_participation' => ['notify_comment_participation', DI::l10n()->t('Someone commented in a thread where you commented'), $notify_type & 16, ''],
|
||||
'$notify_activity_participation' => ['notify_activity_participation', DI::l10n()->t('Someone commented on a thread where you interacted'), $notify_type & 32, ''],
|
||||
'$notify_thread_comment' => ['notify_thread_comment', DI::l10n()->t('Someone commented on your thread'), $notify_type & UserNotification::TYPE_THREAD_COMMENT, ''],
|
||||
'$notify_comment_participation' => ['notify_comment_participation', DI::l10n()->t('Someone commented in a thread where you commented'), $notify_type & UserNotification::TYPE_COMMENT_PARTICIPATION, ''],
|
||||
'$notify_activity_participation' => ['notify_activity_participation', DI::l10n()->t('Someone commented on a thread where you interacted'), $notify_type & UserNotification::TYPE_ACTIVITY_PARTICIPATION, ''],
|
||||
|
||||
'$desktop_notifications' => ['desktop_notifications', DI::l10n()->t('Activate desktop notifications'), false, DI::l10n()->t('Show desktop popup on new notifications')],
|
||||
|
||||
|
|
|
@ -677,19 +677,7 @@ class Notify extends BaseRepository
|
|||
|
||||
$notify_type = $this->pConfig->get($Notification->uid, 'system', 'notify_type', 3 | 72 | 4 | 16 | 32);
|
||||
|
||||
if (($notify_type & 3) && in_array($Notification->type, [Model\Post\UserNotification::TYPE_EXPLICIT_TAGGED, Model\Post\UserNotification::TYPE_IMPLICIT_TAGGED])) {
|
||||
return true;
|
||||
}
|
||||
if (($notify_type & 72) && in_array($Notification->type, [Model\Post\UserNotification::TYPE_DIRECT_COMMENT, Model\Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {
|
||||
return true;
|
||||
}
|
||||
if (($notify_type & 4) && in_array($Notification->type, [Model\Post\UserNotification::TYPE_THREAD_COMMENT])) {
|
||||
return true;
|
||||
}
|
||||
if (($notify_type & 16) && in_array($Notification->type, [Model\Post\UserNotification::TYPE_COMMENT_PARTICIPATION])) {
|
||||
return true;
|
||||
}
|
||||
if (($notify_type & 32) && in_array($Notification->type, [Model\Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION])) {
|
||||
if ($notify_type & $Notification->type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue