chore: Replace custom shorten function with existing Util method

Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
Josh 2025-11-03 11:06:12 -05:00 committed by GitHub
parent bc192310bd
commit 82c64b3507
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,6 +53,7 @@ use OCP\Server;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager as IShareManager;
use OCP\Share\IShare;
use OCP\Util;
use Psr\Log\LoggerInterface;
class Notifier implements INotifier {
@ -294,14 +295,6 @@ class Notifier implements INotifier {
throw new UnknownNotificationException('Unknown subject');
}
protected function shortenJsonEncodedMultibyteSave(string $subject, int $dataLength): string {
$temp = mb_substr($subject, 0, $dataLength);
while (strlen(json_encode($temp)) > $dataLength) {
$temp = mb_substr($temp, 0, -5);
}
return $temp;
}
protected function parseStoredRecordingFail(
INotification $notification,
Room $room,
@ -687,7 +680,7 @@ class Notifier implements INotifier {
$richSubjectParameters = [];
} elseif ($this->notificationManager->isPreparingPushNotification()) {
$shortenMessage = $this->shortenJsonEncodedMultibyteSave($parsedMessage, 100);
$shortenMessage = Util::shortenMultibyteString($parsedMessage, 100);
if ($shortenMessage !== $parsedMessage) {
$shortenMessage .= '…';
}