Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-07-27 12:52:15 +0300
committerJoas Schilling <coding@schilljs.com>2018-08-09 13:43:27 +0300
commitafcc112b7520ed9f37faa052b00a4ef18b328250 (patch)
treee9c1063f817d934d30cb59b7a5b2196b9c5abdd7 /lib/Notification/Notifier.php
parentf425276bc097727912a59bc37226609af9a48500 (diff)
Always add the call to the rich subject
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r--lib/Notification/Notifier.php74
1 files changed, 48 insertions, 26 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php
index 930d0728f..a38b19b13 100644
--- a/lib/Notification/Notifier.php
+++ b/lib/Notification/Notifier.php
@@ -155,15 +155,12 @@ class Notifier implements INotifier {
$isGuest = true;
}
- $richSubjectCall = null;
- if ($room->getName() !== '') {
- $richSubjectCall = [
- 'type' => 'call',
- 'id' => $room->getId(),
- 'name' => $room->getName(),
- 'call-type' => $this->getRoomType($room),
- ];
- }
+ $richSubjectCall = [
+ 'type' => 'call',
+ 'id' => $room->getId(),
+ 'name' => $room->getName() !== '' ? $room->getName() : $l->t('a conversation'),
+ 'call-type' => $this->getRoomType($room),
+ ];
$messageParameters = $notification->getMessageParameters();
if (!isset($messageParameters['commentId'])) {
@@ -195,7 +192,8 @@ class Notifier implements INotifier {
->setParsedSubject(str_replace('{user}', $user->getDisplayName(), $l->t('{user} sent you a private message')))
->setRichSubject(
$l->t('{user} sent you a private message'), [
- 'user' => $richSubjectUser
+ 'user' => $richSubjectUser,
+ 'call' => $richSubjectCall,
]
);
@@ -206,12 +204,13 @@ class Notifier implements INotifier {
)
->setRichSubject(
$l->t('{user} mentioned you in a private conversation'), [
- 'user' => $richSubjectUser
+ 'user' => $richSubjectUser,
+ 'call' => $richSubjectCall,
]
);
} else if (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
- if ($richSubjectUser && $richSubjectCall) {
+ if ($richSubjectUser && $room->getName() !== '') {
$notification
->setParsedSubject(
$l->t('%s mentioned you in a group conversation: %s', [$user->getDisplayName(), $room->getName()])
@@ -219,54 +218,59 @@ class Notifier implements INotifier {
->setRichSubject(
$l->t('{user} mentioned you in a group conversation: {call}'), [
'user' => $richSubjectUser,
- 'call' => $richSubjectCall
+ 'call' => $richSubjectCall,
]
);
- } else if ($richSubjectUser && !$richSubjectCall) {
+ } else if ($richSubjectUser) {
$notification
->setParsedSubject(
$l->t('%s mentioned you in a group conversation', [$user->getDisplayName()])
)
->setRichSubject(
$l->t('{user} mentioned you in a group conversation'), [
- 'user' => $richSubjectUser
+ 'user' => $richSubjectUser,
+ 'call' => $richSubjectCall,
]
);
- } else if (!$richSubjectUser && !$isGuest && $richSubjectCall) {
+ } else if (!$isGuest && $room->getName() !== '') {
$notification
->setParsedSubject(
$l->t('You were mentioned in a group conversation by a deleted user: %s', [$room->getName()])
)
->setRichSubject(
$l->t('You were mentioned in a group conversation by a deleted user: {call}'), [
- 'call' => $richSubjectCall
+ 'call' => $richSubjectCall,
]
);
- } else if (!$richSubjectUser && !$isGuest && !$richSubjectCall) {
+ } else if (!$isGuest) {
$notification
->setParsedSubject(
$l->t('You were mentioned in a group conversation by a deleted user')
)
->setRichSubject(
- $l->t('You were mentioned in a group conversation by a deleted user')
+ $l->t('You were mentioned in a group conversation by a deleted user'), [
+ 'call' => $richSubjectCall,
+ ]
);
- } else if (!$richSubjectUser && $isGuest && $richSubjectCall) {
+ } else if ($room->getName() !== '') {
$notification
->setParsedSubject(
$l->t('A guest mentioned you in a group conversation: %s', [$room->getName()])
)
->setRichSubject(
$l->t('A guest mentioned you in a group conversation: {call}'), [
- 'call' => $richSubjectCall
+ 'call' => $richSubjectCall,
]
);
- } else if (!$richSubjectUser && $isGuest && !$richSubjectCall) {
+ } else {
$notification
->setParsedSubject(
$l->t('A guest mentioned you in a group conversation')
)
->setRichSubject(
- $l->t('A guest mentioned you in a group conversation')
+ $l->t('A guest mentioned you in a group conversation'), [
+ 'call' => $richSubjectCall,
+ ]
);
}
} else {
@@ -325,7 +329,13 @@ class Notifier implements INotifier {
'type' => 'user',
'id' => $uid,
'name' => $user->getDisplayName(),
- ]
+ ],
+ 'call' => [
+ 'type' => 'call',
+ 'id' => $room->getId(),
+ 'name' => $l->t('a conversation'),
+ 'call-type' => $this->getRoomType($room),
+ ],
]
);
@@ -361,7 +371,13 @@ class Notifier implements INotifier {
'type' => 'user',
'id' => $uid,
'name' => $user->getDisplayName(),
- ]
+ ],
+ 'call' => [
+ 'type' => 'call',
+ 'id' => $room->getId(),
+ 'name' => $l->t('a conversation'),
+ 'call-type' => $this->getRoomType($room),
+ ],
]
);
}
@@ -399,7 +415,13 @@ class Notifier implements INotifier {
'type' => 'user',
'id' => $calleeId,
'name' => $user->getDisplayName(),
- ]
+ ],
+ 'call' => [
+ 'type' => 'call',
+ 'id' => $room->getId(),
+ 'name' => $l->t('a conversation'),
+ 'call-type' => $this->getRoomType($room),
+ ],
]
);
} else {