From 1537aeb54ad5523b7cb7c6f91aa42b24b27b0976 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 30 Jul 2020 10:45:11 +0200 Subject: [PATCH] "Too few arguments in L10NString" for all federated share notifications Signed-off-by: Joas Schilling --- apps/federatedfilesharing/lib/Notifier.php | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/apps/federatedfilesharing/lib/Notifier.php b/apps/federatedfilesharing/lib/Notifier.php index 46081240d6a41..27c7b36455607 100644 --- a/apps/federatedfilesharing/lib/Notifier.php +++ b/apps/federatedfilesharing/lib/Notifier.php @@ -102,9 +102,16 @@ public function prepare(INotification $notification, string $languageCode): INot $params = $notification->getSubjectParameters(); if ($params[0] !== $params[1] && $params[1] !== null) { - $notification->setParsedSubject( - $l->t('You received "%3$s" as a remote share from %4$s (%1$s) (on behalf of %5$s (%2$s))', $params) - ); + if (count($params) === 3) { + // Legacy: prior 17.0.5 + $notification->setParsedSubject( + $l->t('You received "%3$s" as a remote share from %1$s (on behalf of %2$s)', $params) + ); + } else { + $notification->setParsedSubject( + $l->t('You received "%3$s" as a remote share from %4$s (%1$s) (on behalf of %5$s (%2$s))', $params) + ); + } $initiator = $params[0]; $initiatorDisplay = isset($params[3]) ? $params[3] : null; @@ -124,9 +131,16 @@ public function prepare(INotification $notification, string $languageCode): INot ] ); } else { - $notification->setParsedSubject( - $l->t('You received "%3$s" as a remote share from %4$s (%1$s)', $params) - ); + if (count($params) === 3) { + // Legacy: prior 17.0.5 + $notification->setParsedSubject( + $l->t('You received "%3$s" as a remote share from %1$s', $params) + ); + } else { + $notification->setParsedSubject( + $l->t('You received "%3$s" as a remote share from %4$s (%1$s)', $params) + ); + } $owner = $params[0]; $ownerDisplay = isset($params[3]) ? $params[3] : null;