Skip to content

Commit a315a19

Browse files
committed
fix(share): Don't print twice the same information
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
1 parent 5af0d13 commit a315a19

File tree

3 files changed

+16
-31
lines changed

3 files changed

+16
-31
lines changed

apps/sharebymail/lib/ShareByMailProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ protected function sendEmail(IShare $share, array $emails): void {
333333
$emailTemplate->setSubject($this->l->t('%1$s shared %2$s with you', [$initiatorDisplayName, $filename]));
334334
$emailTemplate->addHeader();
335335
$emailTemplate->addHeading($this->l->t('%1$s shared %2$s with you', [$initiatorDisplayName, $filename]), false);
336-
$text = $this->l->t('%1$s shared %2$s with you.', [$initiatorDisplayName, $filename]);
337336

338337
if ($note !== '') {
339338
$emailTemplate->addBodyListItem(
@@ -354,8 +353,7 @@ protected function sendEmail(IShare $share, array $emails): void {
354353
}
355354

356355
$emailTemplate->addBodyText(
357-
htmlspecialchars($text . ' ' . $this->l->t('Click the button below to open it.')),
358-
$text
356+
$this->l->t('Click the button below to open it.')
359357
);
360358

361359
$emailTemplate->addBodyButton(

apps/sharebymail/tests/ShareByMailProviderTest.php

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,10 +1292,7 @@ public function testSendMailNotificationWithSameUserAndUserEmail(): void {
12921292
$template
12931293
->expects($this->once())
12941294
->method('addBodyText')
1295-
->with(
1296-
'Mrs. Owner User shared file.txt with you. Click the button below to open it.',
1297-
'Mrs. Owner User shared file.txt with you.'
1298-
);
1295+
->with('Click the button below to open it.');
12991296
$template
13001297
->expects($this->once())
13011298
->method('addBodyButton')
@@ -1405,7 +1402,7 @@ public function testSendMailNotificationWithSameUserAndUserEmailAndNote(): void
14051402
$template
14061403
->expects($this->once())
14071404
->method('addBodyText')
1408-
->with('Mrs. Owner User shared file.txt with you. Click the button below to open it.', 'Mrs. Owner User shared file.txt with you.');
1405+
->with('Click the button below to open it.');
14091406

14101407
$this->urlGenerator->expects($this->once())->method('imagePath')
14111408
->with('core', 'caldav/description.png')
@@ -1531,7 +1528,7 @@ public function testSendMailNotificationWithSameUserAndUserEmailAndExpiration():
15311528
$template
15321529
->expects($this->once())
15331530
->method('addBodyText')
1534-
->with('Mrs. Owner User shared file.txt with you. Click the button below to open it.', 'Mrs. Owner User shared file.txt with you.');
1531+
->with('Click the button below to open it.');
15351532

15361533
$expiration = new DateTime('2001-01-01');
15371534
$this->l->expects($this->once())
@@ -1663,10 +1660,7 @@ public function testSendMailNotificationWithDifferentUserAndNoUserEmail(): void
16631660
$template
16641661
->expects($this->once())
16651662
->method('addBodyText')
1666-
->with(
1667-
'Mr. Initiator User shared file.txt with you. Click the button below to open it.',
1668-
'Mr. Initiator User shared file.txt with you.'
1669-
);
1663+
->with('Click the button below to open it.');
16701664
$template
16711665
->expects($this->once())
16721666
->method('addBodyButton')
@@ -1767,10 +1761,7 @@ public function testSendMailNotificationWithSameUserAndUserEmailAndReplyToDesact
17671761
$template
17681762
->expects($this->once())
17691763
->method('addBodyText')
1770-
->with(
1771-
'Mrs. Owner User shared file.txt with you. Click the button below to open it.',
1772-
'Mrs. Owner User shared file.txt with you.'
1773-
);
1764+
->with('Click the button below to open it.');
17741765
$template
17751766
->expects($this->once())
17761767
->method('addBodyButton')
@@ -1875,10 +1866,7 @@ public function testSendMailNotificationWithDifferentUserAndNoUserEmailAndReplyT
18751866
$template
18761867
->expects($this->once())
18771868
->method('addBodyText')
1878-
->with(
1879-
'Mr. Initiator User shared file.txt with you. Click the button below to open it.',
1880-
'Mr. Initiator User shared file.txt with you.'
1881-
);
1869+
->with('Click the button below to open it.');
18821870
$template
18831871
->expects($this->once())
18841872
->method('addBodyButton')

lib/private/Share20/DefaultShareProvider.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,21 +1512,20 @@ protected function sendUserShareMail(
15121512
'shareWith' => $shareWith,
15131513
]);
15141514

1515-
$emailTemplate->setSubject($l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]));
1515+
$emailTemplate->setSubject($l->t('%1$s shared %2$s with you', [$initiatorDisplayName, $filename]));
15161516
$emailTemplate->addHeader();
1517-
$emailTemplate->addHeading($l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]), false);
1518-
$text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]);
1517+
$emailTemplate->addHeading($l->t('%1$s shared %2$s with you', [$initiatorDisplayName, $filename]), false);
15191518

15201519
if ($note !== '') {
15211520
$emailTemplate->addBodyText(htmlspecialchars($note), $note);
15221521
}
15231522

15241523
$emailTemplate->addBodyText(
1525-
htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')),
1526-
$text
1524+
$l->t('Click the button below to open it.')
15271525
);
1526+
15281527
$emailTemplate->addBodyButton(
1529-
$l->t('Open »%s«', [$filename]),
1528+
$l->t('Open %s', [$filename]),
15301529
$link
15311530
);
15321531

@@ -1601,20 +1600,20 @@ private function sendNote(array $recipients, IShare $share) {
16011600
$initiatorUser = $this->userManager->get($initiator);
16021601
$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
16031602
$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;
1604-
$plainHeading = $l->t('%1$s shared »%2$s« with you and wants to add:', [$initiatorDisplayName, $filename]);
1605-
$htmlHeading = $l->t('%1$s shared »%2$s« with you and wants to add', [$initiatorDisplayName, $filename]);
1603+
$plainHeading = $l->t('%1$s shared %2$s with you and wants to add:', [$initiatorDisplayName, $filename]);
1604+
$htmlHeading = $l->t('%1$s shared %2$s with you and wants to add', [$initiatorDisplayName, $filename]);
16061605
$message = $this->mailer->createMessage();
16071606

16081607
$emailTemplate = $this->mailer->createEMailTemplate('defaultShareProvider.sendNote');
16091608

1610-
$emailTemplate->setSubject($l->t('»%s« added a note to a file shared with you', [$initiatorDisplayName]));
1609+
$emailTemplate->setSubject($l->t('%s added a note to a file shared with you', [$initiatorDisplayName]));
16111610
$emailTemplate->addHeader();
16121611
$emailTemplate->addHeading($htmlHeading, $plainHeading);
16131612
$emailTemplate->addBodyText(htmlspecialchars($note), $note);
16141613

16151614
$link = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]);
16161615
$emailTemplate->addBodyButton(
1617-
$l->t('Open »%s«', [$filename]),
1616+
$l->t('Open %s', [$filename]),
16181617
$link
16191618
);
16201619

0 commit comments

Comments
 (0)