]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix check after change from string to mb_string
authorVitor Mattos <vitor@php.rio>
Mon, 17 Jan 2022 12:14:56 +0000 (09:14 -0300)
committerVitor Mattos <vitor@php.rio>
Fri, 21 Jan 2022 11:39:41 +0000 (08:39 -0300)
Signed-off-by: Vitor Mattos <vitor@php.rio>
lib/private/Comments/Manager.php
tests/lib/Comments/ManagerTest.php

index a8c4e2bf09e9b8c77ec3c44f132971b32dbc9288..e87ac5cd5cc0a897dacd9ac7bd30c7b9b79a0158 100644 (file)
@@ -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() === '') {
index cba314e880bbbede0e957848707ae9c9cf522768..d1d9a8a05d4c0975804db214050c0dcafddc37f9 100644 (file)
@@ -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],