mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
chore: Replace custom shorten function with existing Util method
Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
bc192310bd
commit
82c64b3507
1 changed files with 2 additions and 9 deletions
|
|
@ -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 .= '…';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue