From b9f74584a1e808019235d349fbae3f1fd1bdd711 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 17 Jan 2022 09:14:56 -0300 Subject: [PATCH] Fix check after change from string to mb_string Signed-off-by: Vitor Mattos --- lib/private/Comments/Manager.php | 4 ++-- tests/lib/Comments/ManagerTest.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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], -- 2.39.5