Skip to content

Commit cacc6ef

Browse files
Merge pull request #603 from nextcloud/backport/600/stable20
[stable20] Fix preference name when generating notifications
2 parents 8cac213 + 55f39ce commit cacc6ef

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

lib/NotificationGenerator.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(Data $data, ActivityManager $activityManager, Notifi
4747

4848
public function sendNotificationForEvent(IEvent $event, int $activityId) {
4949
$selfAction = $event->getAffectedUser() === $event->getAuthor();
50-
$notifySetting = $this->userSettings->getUserSetting($event->getAffectedUser(), 'notify', $event->getType());
50+
$notifySetting = $this->userSettings->getUserSetting($event->getAffectedUser(), 'notification', $event->getType());
5151

5252
if ($notifySetting && !$selfAction && $event->getGenerateNotification()) {
5353
$this->notificationManager->notify($this->getNotificationForEvent($event, $activityId));
@@ -63,7 +63,11 @@ private function getNotificationForEvent(IEvent $event, int $activityId): INotif
6363
$notification->setObject('activity_notification', (string)$activityId);
6464
$notification->setSubject($event->getSubject());
6565

66-
if ($notification->getRichMessage()) {
66+
if ($event->getRichSubject()) {
67+
$notification->setRichSubject($event->getRichSubject(), $event->getRichSubjectParameters());
68+
}
69+
70+
if ($event->getRichMessage()) {
6771
$notification->setRichMessage($event->getRichMessage(), $event->getRichMessageParameters());
6872
}
6973

@@ -117,11 +121,15 @@ private function getDisplayNotificationForEvent(IEvent $event, int $activityId):
117121
$notification->setRichSubject($event->getRichSubject(), $event->getRichSubjectParameters());
118122
$notification->setParsedSubject($event->getParsedSubject());
119123

120-
if ($notification->getRichMessage()) {
124+
if ($event->getIcon()) {
125+
$notification->setIcon($event->getIcon());
126+
}
127+
128+
if ($event->getRichMessage()) {
121129
$notification->setRichMessage($event->getRichMessage(), $event->getRichMessageParameters());
122130
}
123131

124-
if ($notification->getParsedMessage()) {
132+
if ($event->getParsedMessage()) {
125133
$notification->setParsedSubject($event->getParsedSubject());
126134
}
127135

0 commit comments

Comments
 (0)