From: Vitor Mattos Date: Mon, 17 Jan 2022 12:14:56 +0000 (-0300) Subject: Fix check after change from string to mb_string X-Git-Tag: v24.0.0beta1~347^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b9f74584a1e808019235d349fbae3f1fd1bdd711;p=nextcloud-server.git Fix check after change from string to mb_string Signed-off-by: Vitor Mattos --- diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index a8c4e2bf09e..e87ac5cd5cc 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -148,8 +148,8 @@ class Manager implements ICommentsManager { throw new \UnexpectedValueException('Actor, Object and Verb information must be provided for saving'); } - if ($comment->getVerb() === 'reaction' && mb_strlen($comment->getMessage()) > 8) { - throw new \UnexpectedValueException('Reactions cannot be longer than 8 bytes'); + if ($comment->getVerb() === 'reaction' && mb_strlen($comment->getMessage()) > 2) { + throw new \UnexpectedValueException('Reactions cannot be longer than 2 chars (emoji with skin tone have two chars)'); } if ($comment->getId() === '') { diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index cba314e880b..d1d9a8a05d4 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -1144,6 +1144,7 @@ class ManagerTest extends TestCase { * @dataProvider providerTestReactionMessageSize */ public function testReactionMessageSize($reactionString, $valid) { + $this->skipIfNotSupport4ByteUTF(); if (!$valid) { $this->expectException(\UnexpectedValueException::class); } @@ -1162,8 +1163,8 @@ class ManagerTest extends TestCase { return [ ['a', true], ['1', true], - ['12345678', true], - ['123456789', false], + ['12', true], + ['123', false], ['👍', true], ['👍👍', true], ['👍🏽', true],