1
0

ManagerTest.php 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace Test\Comments;
  8. use OC\Comments\Comment;
  9. use OC\Comments\Manager;
  10. use OC\EmojiHelper;
  11. use OCP\AppFramework\Utility\ITimeFactory;
  12. use OCP\Comments\IComment;
  13. use OCP\Comments\ICommentsEventHandler;
  14. use OCP\Comments\ICommentsManager;
  15. use OCP\Comments\NotFoundException;
  16. use OCP\Files\Folder;
  17. use OCP\Files\IRootFolder;
  18. use OCP\IConfig;
  19. use OCP\IDBConnection;
  20. use OCP\IInitialStateService;
  21. use OCP\IUser;
  22. use OCP\Server;
  23. use Psr\Log\LoggerInterface;
  24. use Test\TestCase;
  25. /**
  26. * Class ManagerTest
  27. *
  28. * @group DB
  29. */
  30. class ManagerTest extends TestCase {
  31. /** @var IDBConnection */
  32. private $connection;
  33. /** @var \PHPUnit\Framework\MockObject\MockObject|IRootFolder */
  34. private $rootFolder;
  35. protected function setUp(): void {
  36. parent::setUp();
  37. $this->connection = \OC::$server->getDatabaseConnection();
  38. $this->rootFolder = $this->createMock(IRootFolder::class);
  39. $sql = $this->connection->getDatabasePlatform()->getTruncateTableSQL('`*PREFIX*comments`');
  40. $this->connection->prepare($sql)->execute();
  41. $sql = $this->connection->getDatabasePlatform()->getTruncateTableSQL('`*PREFIX*reactions`');
  42. $this->connection->prepare($sql)->execute();
  43. }
  44. protected function addDatabaseEntry($parentId, $topmostParentId, $creationDT = null, $latestChildDT = null, $objectId = null, $expireDate = null) {
  45. if (is_null($creationDT)) {
  46. $creationDT = new \DateTime();
  47. }
  48. if (is_null($latestChildDT)) {
  49. $latestChildDT = new \DateTime('yesterday');
  50. }
  51. if (is_null($objectId)) {
  52. $objectId = 'file64';
  53. }
  54. $qb = $this->connection->getQueryBuilder();
  55. $qb
  56. ->insert('comments')
  57. ->values([
  58. 'parent_id' => $qb->createNamedParameter($parentId),
  59. 'topmost_parent_id' => $qb->createNamedParameter($topmostParentId),
  60. 'children_count' => $qb->createNamedParameter(2),
  61. 'actor_type' => $qb->createNamedParameter('users'),
  62. 'actor_id' => $qb->createNamedParameter('alice'),
  63. 'message' => $qb->createNamedParameter('nice one'),
  64. 'verb' => $qb->createNamedParameter('comment'),
  65. 'creation_timestamp' => $qb->createNamedParameter($creationDT, 'datetime'),
  66. 'latest_child_timestamp' => $qb->createNamedParameter($latestChildDT, 'datetime'),
  67. 'object_type' => $qb->createNamedParameter('files'),
  68. 'object_id' => $qb->createNamedParameter($objectId),
  69. 'expire_date' => $qb->createNamedParameter($expireDate, 'datetime'),
  70. 'reference_id' => $qb->createNamedParameter('referenceId'),
  71. 'meta_data' => $qb->createNamedParameter(json_encode(['last_edit_actor_id' => 'admin'])),
  72. ])
  73. ->execute();
  74. return $qb->getLastInsertId();
  75. }
  76. protected function getManager() {
  77. return new Manager(
  78. $this->connection,
  79. $this->createMock(LoggerInterface::class),
  80. $this->createMock(IConfig::class),
  81. $this->createMock(ITimeFactory::class),
  82. new EmojiHelper($this->connection),
  83. $this->createMock(IInitialStateService::class),
  84. $this->rootFolder,
  85. );
  86. }
  87. public function testGetCommentNotFound() {
  88. $this->expectException(\OCP\Comments\NotFoundException::class);
  89. $manager = $this->getManager();
  90. $manager->get('22');
  91. }
  92. public function testGetCommentNotFoundInvalidInput() {
  93. $this->expectException(\InvalidArgumentException::class);
  94. $manager = $this->getManager();
  95. $manager->get('unexisting22');
  96. }
  97. public function testGetComment() {
  98. $manager = $this->getManager();
  99. $creationDT = new \DateTime();
  100. $latestChildDT = new \DateTime('yesterday');
  101. $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
  102. $qb
  103. ->insert('comments')
  104. ->values([
  105. 'parent_id' => $qb->createNamedParameter('2'),
  106. 'topmost_parent_id' => $qb->createNamedParameter('1'),
  107. 'children_count' => $qb->createNamedParameter(2),
  108. 'actor_type' => $qb->createNamedParameter('users'),
  109. 'actor_id' => $qb->createNamedParameter('alice'),
  110. 'message' => $qb->createNamedParameter('nice one'),
  111. 'verb' => $qb->createNamedParameter('comment'),
  112. 'creation_timestamp' => $qb->createNamedParameter($creationDT, 'datetime'),
  113. 'latest_child_timestamp' => $qb->createNamedParameter($latestChildDT, 'datetime'),
  114. 'object_type' => $qb->createNamedParameter('files'),
  115. 'object_id' => $qb->createNamedParameter('file64'),
  116. 'reference_id' => $qb->createNamedParameter('referenceId'),
  117. 'meta_data' => $qb->createNamedParameter(json_encode(['last_edit_actor_id' => 'admin'])),
  118. ])
  119. ->execute();
  120. $id = strval($qb->getLastInsertId());
  121. $comment = $manager->get($id);
  122. $this->assertTrue($comment instanceof IComment);
  123. $this->assertSame($comment->getId(), $id);
  124. $this->assertSame($comment->getParentId(), '2');
  125. $this->assertSame($comment->getTopmostParentId(), '1');
  126. $this->assertSame($comment->getChildrenCount(), 2);
  127. $this->assertSame($comment->getActorType(), 'users');
  128. $this->assertSame($comment->getActorId(), 'alice');
  129. $this->assertSame($comment->getMessage(), 'nice one');
  130. $this->assertSame($comment->getVerb(), 'comment');
  131. $this->assertSame($comment->getObjectType(), 'files');
  132. $this->assertSame($comment->getObjectId(), 'file64');
  133. $this->assertEquals($comment->getCreationDateTime()->getTimestamp(), $creationDT->getTimestamp());
  134. $this->assertEquals($comment->getLatestChildDateTime(), $latestChildDT);
  135. $this->assertEquals($comment->getReferenceId(), 'referenceId');
  136. $this->assertEquals($comment->getMetaData(), ['last_edit_actor_id' => 'admin']);
  137. }
  138. public function testGetTreeNotFound() {
  139. $this->expectException(\OCP\Comments\NotFoundException::class);
  140. $manager = $this->getManager();
  141. $manager->getTree('22');
  142. }
  143. public function testGetTreeNotFoundInvalidIpnut() {
  144. $this->expectException(\InvalidArgumentException::class);
  145. $manager = $this->getManager();
  146. $manager->getTree('unexisting22');
  147. }
  148. public function testGetTree() {
  149. $headId = $this->addDatabaseEntry(0, 0);
  150. $this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
  151. $this->addDatabaseEntry($headId, $headId, new \DateTime('-2 hours'));
  152. $id = $this->addDatabaseEntry($headId, $headId, new \DateTime('-1 hour'));
  153. $manager = $this->getManager();
  154. $tree = $manager->getTree($headId);
  155. // Verifying the root comment
  156. $this->assertTrue(isset($tree['comment']));
  157. $this->assertTrue($tree['comment'] instanceof IComment);
  158. $this->assertSame($tree['comment']->getId(), strval($headId));
  159. $this->assertTrue(isset($tree['replies']));
  160. $this->assertSame(count($tree['replies']), 3);
  161. // one level deep
  162. foreach ($tree['replies'] as $reply) {
  163. $this->assertTrue($reply['comment'] instanceof IComment);
  164. $this->assertSame($reply['comment']->getId(), strval($id));
  165. $this->assertSame(count($reply['replies']), 0);
  166. $id--;
  167. }
  168. }
  169. public function testGetTreeNoReplies() {
  170. $id = $this->addDatabaseEntry(0, 0);
  171. $manager = $this->getManager();
  172. $tree = $manager->getTree($id);
  173. // Verifying the root comment
  174. $this->assertTrue(isset($tree['comment']));
  175. $this->assertTrue($tree['comment'] instanceof IComment);
  176. $this->assertSame($tree['comment']->getId(), strval($id));
  177. $this->assertTrue(isset($tree['replies']));
  178. $this->assertSame(count($tree['replies']), 0);
  179. // one level deep
  180. foreach ($tree['replies'] as $reply) {
  181. throw new \Exception('This ain`t happen');
  182. }
  183. }
  184. public function testGetTreeWithLimitAndOffset() {
  185. $headId = $this->addDatabaseEntry(0, 0);
  186. $this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
  187. $this->addDatabaseEntry($headId, $headId, new \DateTime('-2 hours'));
  188. $this->addDatabaseEntry($headId, $headId, new \DateTime('-1 hour'));
  189. $idToVerify = $this->addDatabaseEntry($headId, $headId, new \DateTime());
  190. $manager = $this->getManager();
  191. for ($offset = 0; $offset < 3; $offset += 2) {
  192. $tree = $manager->getTree(strval($headId), 2, $offset);
  193. // Verifying the root comment
  194. $this->assertTrue(isset($tree['comment']));
  195. $this->assertTrue($tree['comment'] instanceof IComment);
  196. $this->assertSame($tree['comment']->getId(), strval($headId));
  197. $this->assertTrue(isset($tree['replies']));
  198. $this->assertSame(count($tree['replies']), 2);
  199. // one level deep
  200. foreach ($tree['replies'] as $reply) {
  201. $this->assertTrue($reply['comment'] instanceof IComment);
  202. $this->assertSame($reply['comment']->getId(), strval($idToVerify));
  203. $this->assertSame(count($reply['replies']), 0);
  204. $idToVerify--;
  205. }
  206. }
  207. }
  208. public function testGetForObject() {
  209. $this->addDatabaseEntry(0, 0);
  210. $manager = $this->getManager();
  211. $comments = $manager->getForObject('files', 'file64');
  212. $this->assertTrue(is_array($comments));
  213. $this->assertSame(count($comments), 1);
  214. $this->assertTrue($comments[0] instanceof IComment);
  215. $this->assertSame($comments[0]->getMessage(), 'nice one');
  216. }
  217. public function testGetForObjectWithLimitAndOffset() {
  218. $this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
  219. $this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
  220. $this->addDatabaseEntry(1, 1, new \DateTime('-4 hours'));
  221. $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
  222. $this->addDatabaseEntry(2, 2, new \DateTime('-2 hours'));
  223. $this->addDatabaseEntry(2, 2, new \DateTime('-1 hours'));
  224. $idToVerify = $this->addDatabaseEntry(3, 1, new \DateTime());
  225. $manager = $this->getManager();
  226. $offset = 0;
  227. do {
  228. $comments = $manager->getForObject('files', 'file64', 3, $offset);
  229. $this->assertTrue(is_array($comments));
  230. foreach ($comments as $comment) {
  231. $this->assertTrue($comment instanceof IComment);
  232. $this->assertSame($comment->getMessage(), 'nice one');
  233. $this->assertSame($comment->getId(), strval($idToVerify));
  234. $idToVerify--;
  235. }
  236. $offset += 3;
  237. } while (count($comments) > 0);
  238. }
  239. public function testGetForObjectWithDateTimeConstraint() {
  240. $this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
  241. $this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
  242. $id1 = $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
  243. $id2 = $this->addDatabaseEntry(2, 2, new \DateTime('-2 hours'));
  244. $manager = $this->getManager();
  245. $comments = $manager->getForObject('files', 'file64', 0, 0, new \DateTime('-4 hours'));
  246. $this->assertSame(count($comments), 2);
  247. $this->assertSame($comments[0]->getId(), strval($id2));
  248. $this->assertSame($comments[1]->getId(), strval($id1));
  249. }
  250. public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint() {
  251. $this->addDatabaseEntry(0, 0, new \DateTime('-7 hours'));
  252. $this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
  253. $this->addDatabaseEntry(1, 1, new \DateTime('-5 hours'));
  254. $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
  255. $this->addDatabaseEntry(2, 2, new \DateTime('-2 hours'));
  256. $this->addDatabaseEntry(2, 2, new \DateTime('-1 hours'));
  257. $idToVerify = $this->addDatabaseEntry(3, 1, new \DateTime());
  258. $manager = $this->getManager();
  259. $offset = 0;
  260. do {
  261. $comments = $manager->getForObject('files', 'file64', 3, $offset, new \DateTime('-4 hours'));
  262. $this->assertTrue(is_array($comments));
  263. foreach ($comments as $comment) {
  264. $this->assertTrue($comment instanceof IComment);
  265. $this->assertSame($comment->getMessage(), 'nice one');
  266. $this->assertSame($comment->getId(), strval($idToVerify));
  267. $this->assertTrue(intval($comment->getId()) >= 4);
  268. $idToVerify--;
  269. }
  270. $offset += 3;
  271. } while (count($comments) > 0);
  272. }
  273. public function testGetNumberOfCommentsForObject() {
  274. for ($i = 1; $i < 5; $i++) {
  275. $this->addDatabaseEntry(0, 0);
  276. }
  277. $manager = $this->getManager();
  278. $amount = $manager->getNumberOfCommentsForObject('untype', '00');
  279. $this->assertSame($amount, 0);
  280. $amount = $manager->getNumberOfCommentsForObject('files', 'file64');
  281. $this->assertSame($amount, 4);
  282. }
  283. public function testGetNumberOfUnreadCommentsForFolder() {
  284. $folder = $this->createMock(Folder::class);
  285. $fileIds = range(1111, 1114);
  286. $children = array_map(function (int $id) {
  287. $file = $this->createMock(Folder::class);
  288. $file->method('getId')
  289. ->willReturn($id);
  290. return $file;
  291. }, $fileIds);
  292. $folder->method('getId')->willReturn(1000);
  293. $folder->method('getDirectoryListing')->willReturn($children);
  294. $this->rootFolder->method('getFirstNodeById')
  295. ->with($folder->getId())
  296. ->willReturn($folder);
  297. // 2 comment for 1111 with 1 before read marker
  298. // 2 comments for 1112 with no read marker
  299. // 1 comment for 1113 before read marker
  300. // 1 comment for 1114 with no read marker
  301. $this->addDatabaseEntry(0, 0, null, null, $fileIds[1]);
  302. for ($i = 0; $i < 4; $i++) {
  303. $this->addDatabaseEntry(0, 0, null, null, $fileIds[$i]);
  304. }
  305. $this->addDatabaseEntry(0, 0, (new \DateTime())->modify('-2 days'), null, $fileIds[0]);
  306. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  307. $user = $this->createMock(IUser::class);
  308. $user->expects($this->any())
  309. ->method('getUID')
  310. ->willReturn('comment_test');
  311. $manager = $this->getManager();
  312. $manager->setReadMark('files', (string) $fileIds[0], (new \DateTime())->modify('-1 days'), $user);
  313. $manager->setReadMark('files', (string) $fileIds[2], (new \DateTime()), $user);
  314. $amount = $manager->getNumberOfUnreadCommentsForFolder($folder->getId(), $user);
  315. $this->assertEquals([
  316. $fileIds[0] => 1,
  317. $fileIds[1] => 2,
  318. $fileIds[3] => 1,
  319. ], $amount);
  320. }
  321. /**
  322. * @dataProvider dataGetForObjectSince
  323. * @param $lastKnown
  324. * @param $order
  325. * @param $limit
  326. * @param $resultFrom
  327. * @param $resultTo
  328. */
  329. public function testGetForObjectSince($lastKnown, $order, $limit, $resultFrom, $resultTo) {
  330. $ids = [];
  331. $ids[] = $this->addDatabaseEntry(0, 0);
  332. $ids[] = $this->addDatabaseEntry(0, 0);
  333. $ids[] = $this->addDatabaseEntry(0, 0);
  334. $ids[] = $this->addDatabaseEntry(0, 0);
  335. $ids[] = $this->addDatabaseEntry(0, 0);
  336. $manager = $this->getManager();
  337. $comments = $manager->getForObjectSince('files', 'file64', ($lastKnown === null ? 0 : $ids[$lastKnown]), $order, $limit);
  338. $expected = array_slice($ids, $resultFrom, $resultTo - $resultFrom + 1);
  339. if ($order === 'desc') {
  340. $expected = array_reverse($expected);
  341. }
  342. $this->assertSame($expected, array_map(function (IComment $c) {
  343. return (int) $c->getId();
  344. }, $comments));
  345. }
  346. public function dataGetForObjectSince() {
  347. return [
  348. [null, 'asc', 20, 0, 4],
  349. [null, 'asc', 2, 0, 1],
  350. [null, 'desc', 20, 0, 4],
  351. [null, 'desc', 2, 3, 4],
  352. [1, 'asc', 20, 2, 4],
  353. [1, 'asc', 2, 2, 3],
  354. [3, 'desc', 20, 0, 2],
  355. [3, 'desc', 2, 1, 2],
  356. ];
  357. }
  358. public function invalidCreateArgsProvider() {
  359. return [
  360. ['', 'aId-1', 'oType-1', 'oId-1'],
  361. ['aType-1', '', 'oType-1', 'oId-1'],
  362. ['aType-1', 'aId-1', '', 'oId-1'],
  363. ['aType-1', 'aId-1', 'oType-1', ''],
  364. [1, 'aId-1', 'oType-1', 'oId-1'],
  365. ['aType-1', 1, 'oType-1', 'oId-1'],
  366. ['aType-1', 'aId-1', 1, 'oId-1'],
  367. ['aType-1', 'aId-1', 'oType-1', 1],
  368. ];
  369. }
  370. /**
  371. * @dataProvider invalidCreateArgsProvider
  372. * @param string $aType
  373. * @param string $aId
  374. * @param string $oType
  375. * @param string $oId
  376. */
  377. public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId) {
  378. $this->expectException(\InvalidArgumentException::class);
  379. $manager = $this->getManager();
  380. $manager->create($aType, $aId, $oType, $oId);
  381. }
  382. public function testCreateComment() {
  383. $actorType = 'bot';
  384. $actorId = 'bob';
  385. $objectType = 'weather';
  386. $objectId = 'bielefeld';
  387. $comment = $this->getManager()->create($actorType, $actorId, $objectType, $objectId);
  388. $this->assertTrue($comment instanceof IComment);
  389. $this->assertSame($comment->getActorType(), $actorType);
  390. $this->assertSame($comment->getActorId(), $actorId);
  391. $this->assertSame($comment->getObjectType(), $objectType);
  392. $this->assertSame($comment->getObjectId(), $objectId);
  393. }
  394. public function testDelete() {
  395. $this->expectException(\OCP\Comments\NotFoundException::class);
  396. $manager = $this->getManager();
  397. $done = $manager->delete('404');
  398. $this->assertFalse($done);
  399. $done = $manager->delete('%');
  400. $this->assertFalse($done);
  401. $done = $manager->delete('');
  402. $this->assertFalse($done);
  403. $id = strval($this->addDatabaseEntry(0, 0));
  404. $comment = $manager->get($id);
  405. $this->assertTrue($comment instanceof IComment);
  406. $done = $manager->delete($id);
  407. $this->assertTrue($done);
  408. $manager->get($id);
  409. }
  410. /**
  411. * @dataProvider providerTestSave
  412. */
  413. public function testSave(string $message, string $actorId, string $verb, ?string $parentId, ?string $id = ''): IComment {
  414. $manager = $this->getManager();
  415. $comment = new Comment();
  416. $comment
  417. ->setId($id)
  418. ->setActor('users', $actorId)
  419. ->setObject('files', 'file64')
  420. ->setMessage($message)
  421. ->setVerb($verb);
  422. if ($parentId) {
  423. $comment->setParentId($parentId);
  424. }
  425. $saveSuccessful = $manager->save($comment);
  426. $this->assertTrue($saveSuccessful);
  427. $this->assertTrue($comment->getId() !== '');
  428. $this->assertTrue($comment->getId() !== '0');
  429. $this->assertTrue(!is_null($comment->getCreationDateTime()));
  430. $loadedComment = $manager->get($comment->getId());
  431. $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
  432. $this->assertEquals($comment->getCreationDateTime()->getTimestamp(), $loadedComment->getCreationDateTime()->getTimestamp());
  433. return $comment;
  434. }
  435. public function providerTestSave(): array {
  436. return [
  437. ['very beautiful, I am impressed!', 'alice', 'comment', null]
  438. ];
  439. }
  440. public function testSaveUpdate() {
  441. $manager = $this->getManager();
  442. $comment = new Comment();
  443. $comment
  444. ->setActor('users', 'alice')
  445. ->setObject('files', 'file64')
  446. ->setMessage('very beautiful, I am impressed!')
  447. ->setVerb('comment')
  448. ->setExpireDate(new \DateTime('+2 hours'));
  449. $manager->save($comment);
  450. $loadedComment = $manager->get($comment->getId());
  451. // Compare current object with database values
  452. $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
  453. $this->assertSame(
  454. $comment->getExpireDate()->format('Y-m-d H:i:s'),
  455. $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
  456. );
  457. // Preserve the original comment to compare after update
  458. $original = clone $comment;
  459. // Update values
  460. $comment->setMessage('very beautiful, I am really so much impressed!')
  461. ->setExpireDate(new \DateTime('+1 hours'));
  462. $manager->save($comment);
  463. $loadedComment = $manager->get($comment->getId());
  464. // Compare current object with database values
  465. $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
  466. $this->assertSame(
  467. $comment->getExpireDate()->format('Y-m-d H:i:s'),
  468. $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
  469. );
  470. // Compare original object with database values
  471. $this->assertNotSame($original->getMessage(), $loadedComment->getMessage());
  472. $this->assertNotSame(
  473. $original->getExpireDate()->format('Y-m-d H:i:s'),
  474. $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
  475. );
  476. }
  477. public function testSaveUpdateException() {
  478. $this->expectException(\OCP\Comments\NotFoundException::class);
  479. $manager = $this->getManager();
  480. $comment = new Comment();
  481. $comment
  482. ->setActor('users', 'alice')
  483. ->setObject('files', 'file64')
  484. ->setMessage('very beautiful, I am impressed!')
  485. ->setVerb('comment');
  486. $manager->save($comment);
  487. $manager->delete($comment->getId());
  488. $comment->setMessage('very beautiful, I am really so much impressed!');
  489. $manager->save($comment);
  490. }
  491. public function testSaveIncomplete() {
  492. $this->expectException(\UnexpectedValueException::class);
  493. $manager = $this->getManager();
  494. $comment = new Comment();
  495. $comment->setMessage('from no one to nothing');
  496. $manager->save($comment);
  497. }
  498. public function testSaveAsChild() {
  499. $id = $this->addDatabaseEntry(0, 0);
  500. $manager = $this->getManager();
  501. for ($i = 0; $i < 3; $i++) {
  502. $comment = new Comment();
  503. $comment
  504. ->setActor('users', 'alice')
  505. ->setObject('files', 'file64')
  506. ->setParentId(strval($id))
  507. ->setMessage('full ack')
  508. ->setVerb('comment')
  509. // setting the creation time avoids using sleep() while making sure to test with different timestamps
  510. ->setCreationDateTime(new \DateTime('+' . $i . ' minutes'));
  511. $manager->save($comment);
  512. $this->assertSame($comment->getTopmostParentId(), strval($id));
  513. $parentComment = $manager->get(strval($id));
  514. $this->assertSame($parentComment->getChildrenCount(), $i + 1);
  515. $this->assertEquals($parentComment->getLatestChildDateTime()->getTimestamp(), $comment->getCreationDateTime()->getTimestamp());
  516. }
  517. }
  518. public function invalidActorArgsProvider() {
  519. return
  520. [
  521. ['', ''],
  522. [1, 'alice'],
  523. ['users', 1],
  524. ];
  525. }
  526. /**
  527. * @dataProvider invalidActorArgsProvider
  528. * @param string $type
  529. * @param string $id
  530. */
  531. public function testDeleteReferencesOfActorInvalidInput($type, $id) {
  532. $this->expectException(\InvalidArgumentException::class);
  533. $manager = $this->getManager();
  534. $manager->deleteReferencesOfActor($type, $id);
  535. }
  536. public function testDeleteReferencesOfActor() {
  537. $ids = [];
  538. $ids[] = $this->addDatabaseEntry(0, 0);
  539. $ids[] = $this->addDatabaseEntry(0, 0);
  540. $ids[] = $this->addDatabaseEntry(0, 0);
  541. $manager = $this->getManager();
  542. // just to make sure they are really set, with correct actor data
  543. $comment = $manager->get(strval($ids[1]));
  544. $this->assertSame($comment->getActorType(), 'users');
  545. $this->assertSame($comment->getActorId(), 'alice');
  546. $wasSuccessful = $manager->deleteReferencesOfActor('users', 'alice');
  547. $this->assertTrue($wasSuccessful);
  548. foreach ($ids as $id) {
  549. $comment = $manager->get(strval($id));
  550. $this->assertSame($comment->getActorType(), ICommentsManager::DELETED_USER);
  551. $this->assertSame($comment->getActorId(), ICommentsManager::DELETED_USER);
  552. }
  553. // actor info is gone from DB, but when database interaction is alright,
  554. // we still expect to get true back
  555. $wasSuccessful = $manager->deleteReferencesOfActor('users', 'alice');
  556. $this->assertTrue($wasSuccessful);
  557. }
  558. public function testDeleteReferencesOfActorWithUserManagement() {
  559. $user = \OC::$server->getUserManager()->createUser('xenia', '123456');
  560. $this->assertTrue($user instanceof IUser);
  561. $manager = \OC::$server->get(ICommentsManager::class);
  562. $comment = $manager->create('users', $user->getUID(), 'files', 'file64');
  563. $comment
  564. ->setMessage('Most important comment I ever left on the Internet.')
  565. ->setVerb('comment');
  566. $status = $manager->save($comment);
  567. $this->assertTrue($status);
  568. $commentID = $comment->getId();
  569. $user->delete();
  570. $comment = $manager->get($commentID);
  571. $this->assertSame($comment->getActorType(), ICommentsManager::DELETED_USER);
  572. $this->assertSame($comment->getActorId(), ICommentsManager::DELETED_USER);
  573. }
  574. public function invalidObjectArgsProvider() {
  575. return
  576. [
  577. ['', ''],
  578. [1, 'file64'],
  579. ['files', 1],
  580. ];
  581. }
  582. /**
  583. * @dataProvider invalidObjectArgsProvider
  584. * @param string $type
  585. * @param string $id
  586. */
  587. public function testDeleteCommentsAtObjectInvalidInput($type, $id) {
  588. $this->expectException(\InvalidArgumentException::class);
  589. $manager = $this->getManager();
  590. $manager->deleteCommentsAtObject($type, $id);
  591. }
  592. public function testDeleteCommentsAtObject() {
  593. $ids = [];
  594. $ids[] = $this->addDatabaseEntry(0, 0);
  595. $ids[] = $this->addDatabaseEntry(0, 0);
  596. $ids[] = $this->addDatabaseEntry(0, 0);
  597. $manager = $this->getManager();
  598. // just to make sure they are really set, with correct actor data
  599. $comment = $manager->get(strval($ids[1]));
  600. $this->assertSame($comment->getObjectType(), 'files');
  601. $this->assertSame($comment->getObjectId(), 'file64');
  602. $wasSuccessful = $manager->deleteCommentsAtObject('files', 'file64');
  603. $this->assertTrue($wasSuccessful);
  604. $verified = 0;
  605. foreach ($ids as $id) {
  606. try {
  607. $manager->get(strval($id));
  608. } catch (NotFoundException $e) {
  609. $verified++;
  610. }
  611. }
  612. $this->assertSame($verified, 3);
  613. // actor info is gone from DB, but when database interaction is alright,
  614. // we still expect to get true back
  615. $wasSuccessful = $manager->deleteCommentsAtObject('files', 'file64');
  616. $this->assertTrue($wasSuccessful);
  617. }
  618. public function testDeleteCommentsExpiredAtObjectTypeAndId(): void {
  619. $ids = [];
  620. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('+2 hours'));
  621. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('+2 hours'));
  622. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('+2 hours'));
  623. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('-2 hours'));
  624. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('-2 hours'));
  625. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('-2 hours'));
  626. $manager = new Manager(
  627. $this->connection,
  628. $this->createMock(LoggerInterface::class),
  629. $this->createMock(IConfig::class),
  630. Server::get(ITimeFactory::class),
  631. new EmojiHelper($this->connection),
  632. $this->createMock(IInitialStateService::class),
  633. $this->rootFolder,
  634. );
  635. // just to make sure they are really set, with correct actor data
  636. $comment = $manager->get((string) $ids[1]);
  637. $this->assertSame($comment->getObjectType(), 'files');
  638. $this->assertSame($comment->getObjectId(), 'file64');
  639. $deleted = $manager->deleteCommentsExpiredAtObject('files', 'file64');
  640. $this->assertTrue($deleted);
  641. $deleted = 0;
  642. $exists = 0;
  643. foreach ($ids as $id) {
  644. try {
  645. $manager->get((string) $id);
  646. $exists++;
  647. } catch (NotFoundException $e) {
  648. $deleted++;
  649. }
  650. }
  651. $this->assertSame($exists, 3);
  652. $this->assertSame($deleted, 3);
  653. // actor info is gone from DB, but when database interaction is alright,
  654. // we still expect to get true back
  655. $deleted = $manager->deleteCommentsExpiredAtObject('files', 'file64');
  656. $this->assertFalse($deleted);
  657. }
  658. public function testDeleteCommentsExpiredAtObjectType(): void {
  659. $ids = [];
  660. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file1', new \DateTime('-2 hours'));
  661. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file2', new \DateTime('-2 hours'));
  662. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime('-2 hours'));
  663. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime());
  664. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime());
  665. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime());
  666. $manager = new Manager(
  667. $this->connection,
  668. $this->createMock(LoggerInterface::class),
  669. $this->createMock(IConfig::class),
  670. Server::get(ITimeFactory::class),
  671. new EmojiHelper($this->connection),
  672. $this->createMock(IInitialStateService::class),
  673. $this->rootFolder,
  674. );
  675. $deleted = $manager->deleteCommentsExpiredAtObject('files');
  676. $this->assertTrue($deleted);
  677. $deleted = 0;
  678. $exists = 0;
  679. foreach ($ids as $id) {
  680. try {
  681. $manager->get((string) $id);
  682. $exists++;
  683. } catch (NotFoundException $e) {
  684. $deleted++;
  685. }
  686. }
  687. $this->assertSame($exists, 0);
  688. $this->assertSame($deleted, 6);
  689. // actor info is gone from DB, but when database interaction is alright,
  690. // we still expect to get true back
  691. $deleted = $manager->deleteCommentsExpiredAtObject('files');
  692. $this->assertFalse($deleted);
  693. }
  694. public function testSetMarkRead() {
  695. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  696. $user = $this->createMock(IUser::class);
  697. $user->expects($this->any())
  698. ->method('getUID')
  699. ->willReturn('alice');
  700. $dateTimeSet = new \DateTime();
  701. $manager = $this->getManager();
  702. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  703. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  704. $this->assertEquals($dateTimeGet->getTimestamp(), $dateTimeSet->getTimestamp());
  705. }
  706. public function testSetMarkReadUpdate() {
  707. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  708. $user = $this->createMock(IUser::class);
  709. $user->expects($this->any())
  710. ->method('getUID')
  711. ->willReturn('alice');
  712. $dateTimeSet = new \DateTime('yesterday');
  713. $manager = $this->getManager();
  714. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  715. $dateTimeSet = new \DateTime('today');
  716. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  717. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  718. $this->assertEquals($dateTimeGet, $dateTimeSet);
  719. }
  720. public function testReadMarkDeleteUser() {
  721. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  722. $user = $this->createMock(IUser::class);
  723. $user->expects($this->any())
  724. ->method('getUID')
  725. ->willReturn('alice');
  726. $dateTimeSet = new \DateTime();
  727. $manager = $this->getManager();
  728. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  729. $manager->deleteReadMarksFromUser($user);
  730. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  731. $this->assertNull($dateTimeGet);
  732. }
  733. public function testReadMarkDeleteObject() {
  734. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  735. $user = $this->createMock(IUser::class);
  736. $user->expects($this->any())
  737. ->method('getUID')
  738. ->willReturn('alice');
  739. $dateTimeSet = new \DateTime();
  740. $manager = $this->getManager();
  741. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  742. $manager->deleteReadMarksOnObject('robot', '36');
  743. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  744. $this->assertNull($dateTimeGet);
  745. }
  746. public function testSendEvent() {
  747. $handler1 = $this->getMockBuilder(ICommentsEventHandler::class)->getMock();
  748. $handler1->expects($this->exactly(4))
  749. ->method('handle');
  750. $handler2 = $this->getMockBuilder(ICommentsEventHandler::class)->getMock();
  751. $handler1->expects($this->exactly(4))
  752. ->method('handle');
  753. $manager = $this->getManager();
  754. $manager->registerEventHandler(function () use ($handler1) {
  755. return $handler1;
  756. });
  757. $manager->registerEventHandler(function () use ($handler2) {
  758. return $handler2;
  759. });
  760. $comment = new Comment();
  761. $comment
  762. ->setActor('users', 'alice')
  763. ->setObject('files', 'file64')
  764. ->setMessage('very beautiful, I am impressed!')
  765. ->setVerb('comment');
  766. // Add event
  767. $manager->save($comment);
  768. // Update event
  769. $comment->setMessage('Different topic');
  770. $manager->save($comment);
  771. // Delete event
  772. $manager->delete($comment->getId());
  773. }
  774. public function testResolveDisplayName() {
  775. $manager = $this->getManager();
  776. $planetClosure = function ($name) {
  777. return ucfirst($name);
  778. };
  779. $galaxyClosure = function ($name) {
  780. return strtoupper($name);
  781. };
  782. $manager->registerDisplayNameResolver('planet', $planetClosure);
  783. $manager->registerDisplayNameResolver('galaxy', $galaxyClosure);
  784. $this->assertSame('Neptune', $manager->resolveDisplayName('planet', 'neptune'));
  785. $this->assertSame('SOMBRERO', $manager->resolveDisplayName('galaxy', 'sombrero'));
  786. }
  787. public function testRegisterResolverDuplicate() {
  788. $this->expectException(\OutOfBoundsException::class);
  789. $manager = $this->getManager();
  790. $planetClosure = function ($name) {
  791. return ucfirst($name);
  792. };
  793. $manager->registerDisplayNameResolver('planet', $planetClosure);
  794. $manager->registerDisplayNameResolver('planet', $planetClosure);
  795. }
  796. public function testRegisterResolverInvalidType() {
  797. $this->expectException(\InvalidArgumentException::class);
  798. $manager = $this->getManager();
  799. $planetClosure = function ($name) {
  800. return ucfirst($name);
  801. };
  802. $manager->registerDisplayNameResolver(1337, $planetClosure);
  803. }
  804. public function testResolveDisplayNameUnregisteredType() {
  805. $this->expectException(\OutOfBoundsException::class);
  806. $manager = $this->getManager();
  807. $planetClosure = function ($name) {
  808. return ucfirst($name);
  809. };
  810. $manager->registerDisplayNameResolver('planet', $planetClosure);
  811. $manager->resolveDisplayName('galaxy', 'sombrero');
  812. }
  813. public function testResolveDisplayNameDirtyResolver() {
  814. $manager = $this->getManager();
  815. $planetClosure = function () {
  816. return null;
  817. };
  818. $manager->registerDisplayNameResolver('planet', $planetClosure);
  819. $this->assertTrue(is_string($manager->resolveDisplayName('planet', 'neptune')));
  820. }
  821. private function skipIfNotSupport4ByteUTF() {
  822. if (!$this->getManager()->supportReactions()) {
  823. $this->markTestSkipped('MySQL doesn\'t support 4 byte UTF-8');
  824. }
  825. }
  826. /**
  827. * @dataProvider providerTestReactionAddAndDelete
  828. *
  829. * @param IComment[] $comments
  830. * @param array $reactionsExpected
  831. * @return void
  832. */
  833. public function testReactionAddAndDelete(array $comments, array $reactionsExpected) {
  834. $this->skipIfNotSupport4ByteUTF();
  835. $manager = $this->getManager();
  836. $processedComments = $this->proccessComments($comments);
  837. $comment = end($processedComments);
  838. if ($comment->getParentId()) {
  839. $parent = $manager->get($comment->getParentId());
  840. $this->assertEqualsCanonicalizing($reactionsExpected, $parent->getReactions());
  841. }
  842. }
  843. public function providerTestReactionAddAndDelete(): array {
  844. return[
  845. [
  846. [
  847. ['message', 'alice', 'comment', null],
  848. ], [],
  849. ],
  850. [
  851. [
  852. ['message', 'alice', 'comment', null],
  853. ['👍', 'alice', 'reaction', 'message#alice'],
  854. ], ['👍' => 1],
  855. ],
  856. [
  857. [
  858. ['message', 'alice', 'comment', null],
  859. ['👍', 'alice', 'reaction', 'message#alice'],
  860. ['👍', 'alice', 'reaction', 'message#alice'],
  861. ], ['👍' => 1],
  862. ],
  863. [
  864. [
  865. ['message', 'alice', 'comment', null],
  866. ['👍', 'alice', 'reaction', 'message#alice'],
  867. ['👍', 'frank', 'reaction', 'message#alice'],
  868. ], ['👍' => 2],
  869. ],
  870. [
  871. [
  872. ['message', 'alice', 'comment', null],
  873. ['👍', 'alice', 'reaction', 'message#alice'],
  874. ['👍', 'frank', 'reaction', 'message#alice'],
  875. ['👍', 'frank', 'reaction_deleted', 'message#alice'],
  876. ], ['👍' => 1],
  877. ],
  878. [
  879. [
  880. ['message', 'alice', 'comment', null],
  881. ['👍', 'alice', 'reaction', 'message#alice'],
  882. ['👍', 'frank', 'reaction', 'message#alice'],
  883. ['👍', 'alice', 'reaction_deleted', 'message#alice'],
  884. ['👍', 'frank', 'reaction_deleted', 'message#alice'],
  885. ], [],
  886. ],
  887. ];
  888. }
  889. public function testResolveDisplayNameInvalidType() {
  890. $this->expectException(\InvalidArgumentException::class);
  891. $manager = $this->getManager();
  892. $planetClosure = function () {
  893. return null;
  894. };
  895. $manager->registerDisplayNameResolver('planet', $planetClosure);
  896. $this->assertTrue(is_string($manager->resolveDisplayName(1337, 'neptune')));
  897. }
  898. /**
  899. * @param array $data
  900. * @return IComment[]
  901. */
  902. private function proccessComments(array $data): array {
  903. /** @var IComment[] */
  904. $comments = [];
  905. foreach ($data as $comment) {
  906. [$message, $actorId, $verb, $parentText] = $comment;
  907. $parentId = null;
  908. if ($parentText) {
  909. $parentId = (string) $comments[$parentText]->getId();
  910. }
  911. $id = '';
  912. if ($verb === 'reaction_deleted') {
  913. $id = $comments[$message . '#' . $actorId]->getId();
  914. }
  915. $comment = $this->testSave($message, $actorId, $verb, $parentId, $id);
  916. $comments[$comment->getMessage() . '#' . $comment->getActorId()] = $comment;
  917. }
  918. return $comments;
  919. }
  920. /**
  921. * @dataProvider providerTestRetrieveAllReactions
  922. */
  923. public function testRetrieveAllReactions(array $comments, array $expected) {
  924. $this->skipIfNotSupport4ByteUTF();
  925. $manager = $this->getManager();
  926. $processedComments = $this->proccessComments($comments);
  927. $comment = reset($processedComments);
  928. $all = $manager->retrieveAllReactions($comment->getId());
  929. $actual = array_map(function ($row) {
  930. return [
  931. 'message' => $row->getMessage(),
  932. 'actorId' => $row->getActorId(),
  933. ];
  934. }, $all);
  935. $this->assertEqualsCanonicalizing($expected, $actual);
  936. }
  937. public function providerTestRetrieveAllReactions(): array {
  938. return [
  939. [
  940. [
  941. ['message', 'alice', 'comment', null],
  942. ],
  943. [],
  944. ],
  945. [
  946. [
  947. ['message', 'alice', 'comment', null],
  948. ['👍', 'alice', 'reaction', 'message#alice'],
  949. ['👍', 'frank', 'reaction', 'message#alice'],
  950. ],
  951. [
  952. ['👍', 'alice'],
  953. ['👍', 'frank'],
  954. ],
  955. ],
  956. [
  957. [
  958. ['message', 'alice', 'comment', null],
  959. ['👍', 'alice', 'reaction', 'message#alice'],
  960. ['👍', 'alice', 'reaction', 'message#alice'],
  961. ['👍', 'frank', 'reaction', 'message#alice'],
  962. ],
  963. [
  964. ['👍', 'alice'],
  965. ['👍', 'frank'],
  966. ],
  967. ],
  968. [# 600 reactions to cover chunk size when retrieve comments of reactions.
  969. [
  970. ['message', 'alice', 'comment', null],
  971. ['😀', 'alice', 'reaction', 'message#alice'],
  972. ['😃', 'alice', 'reaction', 'message#alice'],
  973. ['😄', 'alice', 'reaction', 'message#alice'],
  974. ['😁', 'alice', 'reaction', 'message#alice'],
  975. ['😆', 'alice', 'reaction', 'message#alice'],
  976. ['😅', 'alice', 'reaction', 'message#alice'],
  977. ['😂', 'alice', 'reaction', 'message#alice'],
  978. ['🤣', 'alice', 'reaction', 'message#alice'],
  979. ['🥲', 'alice', 'reaction', 'message#alice'],
  980. ['🥹', 'alice', 'reaction', 'message#alice'],
  981. ['☺️', 'alice', 'reaction', 'message#alice'],
  982. ['😊', 'alice', 'reaction', 'message#alice'],
  983. ['😇', 'alice', 'reaction', 'message#alice'],
  984. ['🙂', 'alice', 'reaction', 'message#alice'],
  985. ['🙃', 'alice', 'reaction', 'message#alice'],
  986. ['😉', 'alice', 'reaction', 'message#alice'],
  987. ['😌', 'alice', 'reaction', 'message#alice'],
  988. ['😍', 'alice', 'reaction', 'message#alice'],
  989. ['🥰', 'alice', 'reaction', 'message#alice'],
  990. ['😘', 'alice', 'reaction', 'message#alice'],
  991. ['😗', 'alice', 'reaction', 'message#alice'],
  992. ['😙', 'alice', 'reaction', 'message#alice'],
  993. ['😚', 'alice', 'reaction', 'message#alice'],
  994. ['😋', 'alice', 'reaction', 'message#alice'],
  995. ['😛', 'alice', 'reaction', 'message#alice'],
  996. ['😝', 'alice', 'reaction', 'message#alice'],
  997. ['😜', 'alice', 'reaction', 'message#alice'],
  998. ['🤪', 'alice', 'reaction', 'message#alice'],
  999. ['🤨', 'alice', 'reaction', 'message#alice'],
  1000. ['🧐', 'alice', 'reaction', 'message#alice'],
  1001. ['🤓', 'alice', 'reaction', 'message#alice'],
  1002. ['😎', 'alice', 'reaction', 'message#alice'],
  1003. ['🥸', 'alice', 'reaction', 'message#alice'],
  1004. ['🤩', 'alice', 'reaction', 'message#alice'],
  1005. ['🥳', 'alice', 'reaction', 'message#alice'],
  1006. ['😏', 'alice', 'reaction', 'message#alice'],
  1007. ['😒', 'alice', 'reaction', 'message#alice'],
  1008. ['😞', 'alice', 'reaction', 'message#alice'],
  1009. ['😔', 'alice', 'reaction', 'message#alice'],
  1010. ['😟', 'alice', 'reaction', 'message#alice'],
  1011. ['😕', 'alice', 'reaction', 'message#alice'],
  1012. ['🙁', 'alice', 'reaction', 'message#alice'],
  1013. ['☹️', 'alice', 'reaction', 'message#alice'],
  1014. ['😣', 'alice', 'reaction', 'message#alice'],
  1015. ['😖', 'alice', 'reaction', 'message#alice'],
  1016. ['😫', 'alice', 'reaction', 'message#alice'],
  1017. ['😩', 'alice', 'reaction', 'message#alice'],
  1018. ['🥺', 'alice', 'reaction', 'message#alice'],
  1019. ['😢', 'alice', 'reaction', 'message#alice'],
  1020. ['😭', 'alice', 'reaction', 'message#alice'],
  1021. ['😮‍💨', 'alice', 'reaction', 'message#alice'],
  1022. ['😤', 'alice', 'reaction', 'message#alice'],
  1023. ['😠', 'alice', 'reaction', 'message#alice'],
  1024. ['😡', 'alice', 'reaction', 'message#alice'],
  1025. ['🤬', 'alice', 'reaction', 'message#alice'],
  1026. ['🤯', 'alice', 'reaction', 'message#alice'],
  1027. ['😳', 'alice', 'reaction', 'message#alice'],
  1028. ['🥵', 'alice', 'reaction', 'message#alice'],
  1029. ['🥶', 'alice', 'reaction', 'message#alice'],
  1030. ['😱', 'alice', 'reaction', 'message#alice'],
  1031. ['😨', 'alice', 'reaction', 'message#alice'],
  1032. ['😰', 'alice', 'reaction', 'message#alice'],
  1033. ['😥', 'alice', 'reaction', 'message#alice'],
  1034. ['😓', 'alice', 'reaction', 'message#alice'],
  1035. ['🫣', 'alice', 'reaction', 'message#alice'],
  1036. ['🤗', 'alice', 'reaction', 'message#alice'],
  1037. ['🫡', 'alice', 'reaction', 'message#alice'],
  1038. ['🤔', 'alice', 'reaction', 'message#alice'],
  1039. ['🫢', 'alice', 'reaction', 'message#alice'],
  1040. ['🤭', 'alice', 'reaction', 'message#alice'],
  1041. ['🤫', 'alice', 'reaction', 'message#alice'],
  1042. ['🤥', 'alice', 'reaction', 'message#alice'],
  1043. ['😶', 'alice', 'reaction', 'message#alice'],
  1044. ['😶‍🌫️', 'alice', 'reaction', 'message#alice'],
  1045. ['😐', 'alice', 'reaction', 'message#alice'],
  1046. ['😑', 'alice', 'reaction', 'message#alice'],
  1047. ['😬', 'alice', 'reaction', 'message#alice'],
  1048. ['🫠', 'alice', 'reaction', 'message#alice'],
  1049. ['🙄', 'alice', 'reaction', 'message#alice'],
  1050. ['😯', 'alice', 'reaction', 'message#alice'],
  1051. ['😦', 'alice', 'reaction', 'message#alice'],
  1052. ['😧', 'alice', 'reaction', 'message#alice'],
  1053. ['😮', 'alice', 'reaction', 'message#alice'],
  1054. ['😲', 'alice', 'reaction', 'message#alice'],
  1055. ['🥱', 'alice', 'reaction', 'message#alice'],
  1056. ['😴', 'alice', 'reaction', 'message#alice'],
  1057. ['🤤', 'alice', 'reaction', 'message#alice'],
  1058. ['😪', 'alice', 'reaction', 'message#alice'],
  1059. ['😵', 'alice', 'reaction', 'message#alice'],
  1060. ['😵‍💫', 'alice', 'reaction', 'message#alice'],
  1061. ['🫥', 'alice', 'reaction', 'message#alice'],
  1062. ['🤐', 'alice', 'reaction', 'message#alice'],
  1063. ['🥴', 'alice', 'reaction', 'message#alice'],
  1064. ['🤢', 'alice', 'reaction', 'message#alice'],
  1065. ['🤮', 'alice', 'reaction', 'message#alice'],
  1066. ['🤧', 'alice', 'reaction', 'message#alice'],
  1067. ['😷', 'alice', 'reaction', 'message#alice'],
  1068. ['🤒', 'alice', 'reaction', 'message#alice'],
  1069. ['🤕', 'alice', 'reaction', 'message#alice'],
  1070. ['🤑', 'alice', 'reaction', 'message#alice'],
  1071. ['🤠', 'alice', 'reaction', 'message#alice'],
  1072. ['😈', 'alice', 'reaction', 'message#alice'],
  1073. ['👿', 'alice', 'reaction', 'message#alice'],
  1074. ['👹', 'alice', 'reaction', 'message#alice'],
  1075. ['👺', 'alice', 'reaction', 'message#alice'],
  1076. ['🤡', 'alice', 'reaction', 'message#alice'],
  1077. ['💩', 'alice', 'reaction', 'message#alice'],
  1078. ['👻', 'alice', 'reaction', 'message#alice'],
  1079. ['💀', 'alice', 'reaction', 'message#alice'],
  1080. ['☠️', 'alice', 'reaction', 'message#alice'],
  1081. ['👽', 'alice', 'reaction', 'message#alice'],
  1082. ['👾', 'alice', 'reaction', 'message#alice'],
  1083. ['🤖', 'alice', 'reaction', 'message#alice'],
  1084. ['🎃', 'alice', 'reaction', 'message#alice'],
  1085. ['😺', 'alice', 'reaction', 'message#alice'],
  1086. ['😸', 'alice', 'reaction', 'message#alice'],
  1087. ['😹', 'alice', 'reaction', 'message#alice'],
  1088. ['😻', 'alice', 'reaction', 'message#alice'],
  1089. ['😼', 'alice', 'reaction', 'message#alice'],
  1090. ['😽', 'alice', 'reaction', 'message#alice'],
  1091. ['🙀', 'alice', 'reaction', 'message#alice'],
  1092. ['😿', 'alice', 'reaction', 'message#alice'],
  1093. ['😾', 'alice', 'reaction', 'message#alice'],
  1094. ['👶', 'alice', 'reaction', 'message#alice'],
  1095. ['👧', 'alice', 'reaction', 'message#alice'],
  1096. ['🧒', 'alice', 'reaction', 'message#alice'],
  1097. ['👦', 'alice', 'reaction', 'message#alice'],
  1098. ['👩', 'alice', 'reaction', 'message#alice'],
  1099. ['🧑', 'alice', 'reaction', 'message#alice'],
  1100. ['👨', 'alice', 'reaction', 'message#alice'],
  1101. ['👩‍🦱', 'alice', 'reaction', 'message#alice'],
  1102. ['🧑‍🦱', 'alice', 'reaction', 'message#alice'],
  1103. ['👨‍🦱', 'alice', 'reaction', 'message#alice'],
  1104. ['👩‍🦰', 'alice', 'reaction', 'message#alice'],
  1105. ['🧑‍🦰', 'alice', 'reaction', 'message#alice'],
  1106. ['👨‍🦰', 'alice', 'reaction', 'message#alice'],
  1107. ['👱‍♀️', 'alice', 'reaction', 'message#alice'],
  1108. ['👱', 'alice', 'reaction', 'message#alice'],
  1109. ['👱‍♂️', 'alice', 'reaction', 'message#alice'],
  1110. ['👩‍🦳', 'alice', 'reaction', 'message#alice'],
  1111. ['🧑‍🦳', 'alice', 'reaction', 'message#alice'],
  1112. ['👨‍🦳', 'alice', 'reaction', 'message#alice'],
  1113. ['👩‍🦲', 'alice', 'reaction', 'message#alice'],
  1114. ['🧑‍🦲', 'alice', 'reaction', 'message#alice'],
  1115. ['👨‍🦲', 'alice', 'reaction', 'message#alice'],
  1116. ['🧔‍♀️', 'alice', 'reaction', 'message#alice'],
  1117. ['🧔', 'alice', 'reaction', 'message#alice'],
  1118. ['🧔‍♂️', 'alice', 'reaction', 'message#alice'],
  1119. ['👵', 'alice', 'reaction', 'message#alice'],
  1120. ['🧓', 'alice', 'reaction', 'message#alice'],
  1121. ['👴', 'alice', 'reaction', 'message#alice'],
  1122. ['👲', 'alice', 'reaction', 'message#alice'],
  1123. ['👳‍♀️', 'alice', 'reaction', 'message#alice'],
  1124. ['👳', 'alice', 'reaction', 'message#alice'],
  1125. ['👳‍♂️', 'alice', 'reaction', 'message#alice'],
  1126. ['🧕', 'alice', 'reaction', 'message#alice'],
  1127. ['👮‍♀️', 'alice', 'reaction', 'message#alice'],
  1128. ['👮', 'alice', 'reaction', 'message#alice'],
  1129. ['👮‍♂️', 'alice', 'reaction', 'message#alice'],
  1130. ['👷‍♀️', 'alice', 'reaction', 'message#alice'],
  1131. ['👷', 'alice', 'reaction', 'message#alice'],
  1132. ['👷‍♂️', 'alice', 'reaction', 'message#alice'],
  1133. ['💂‍♀️', 'alice', 'reaction', 'message#alice'],
  1134. ['💂', 'alice', 'reaction', 'message#alice'],
  1135. ['💂‍♂️', 'alice', 'reaction', 'message#alice'],
  1136. ['🕵️‍♀️', 'alice', 'reaction', 'message#alice'],
  1137. ['🕵️', 'alice', 'reaction', 'message#alice'],
  1138. ['🕵️‍♂️', 'alice', 'reaction', 'message#alice'],
  1139. ['👩‍⚕️', 'alice', 'reaction', 'message#alice'],
  1140. ['🧑‍⚕️', 'alice', 'reaction', 'message#alice'],
  1141. ['👨‍⚕️', 'alice', 'reaction', 'message#alice'],
  1142. ['👩‍🌾', 'alice', 'reaction', 'message#alice'],
  1143. ['🧑‍🌾', 'alice', 'reaction', 'message#alice'],
  1144. ['👨‍🌾', 'alice', 'reaction', 'message#alice'],
  1145. ['👩‍🍳', 'alice', 'reaction', 'message#alice'],
  1146. ['🧑‍🍳', 'alice', 'reaction', 'message#alice'],
  1147. ['👨‍🍳', 'alice', 'reaction', 'message#alice'],
  1148. ['👩‍🎓', 'alice', 'reaction', 'message#alice'],
  1149. ['🧑‍🎓', 'alice', 'reaction', 'message#alice'],
  1150. ['👨‍🎓', 'alice', 'reaction', 'message#alice'],
  1151. ['👩‍🎤', 'alice', 'reaction', 'message#alice'],
  1152. ['🧑‍🎤', 'alice', 'reaction', 'message#alice'],
  1153. ['👨‍🎤', 'alice', 'reaction', 'message#alice'],
  1154. ['👩‍🏫', 'alice', 'reaction', 'message#alice'],
  1155. ['🧑‍🏫', 'alice', 'reaction', 'message#alice'],
  1156. ['👨‍🏫', 'alice', 'reaction', 'message#alice'],
  1157. ['👩‍🏭', 'alice', 'reaction', 'message#alice'],
  1158. ['🧑‍🏭', 'alice', 'reaction', 'message#alice'],
  1159. ['👨‍🏭', 'alice', 'reaction', 'message#alice'],
  1160. ['👩‍💻', 'alice', 'reaction', 'message#alice'],
  1161. ['🧑‍💻', 'alice', 'reaction', 'message#alice'],
  1162. ['👨‍💻', 'alice', 'reaction', 'message#alice'],
  1163. ['👩‍💼', 'alice', 'reaction', 'message#alice'],
  1164. ['🧑‍💼', 'alice', 'reaction', 'message#alice'],
  1165. ['👨‍💼', 'alice', 'reaction', 'message#alice'],
  1166. ['👩‍🔧', 'alice', 'reaction', 'message#alice'],
  1167. ['🧑‍🔧', 'alice', 'reaction', 'message#alice'],
  1168. ['👨‍🔧', 'alice', 'reaction', 'message#alice'],
  1169. ['👩‍🔬', 'alice', 'reaction', 'message#alice'],
  1170. ['🧑‍🔬', 'alice', 'reaction', 'message#alice'],
  1171. ['👨‍🔬', 'alice', 'reaction', 'message#alice'],
  1172. ['👩‍🎨', 'alice', 'reaction', 'message#alice'],
  1173. ['🧑‍🎨', 'alice', 'reaction', 'message#alice'],
  1174. ['👨‍🎨', 'alice', 'reaction', 'message#alice'],
  1175. ['👩‍🚒', 'alice', 'reaction', 'message#alice'],
  1176. ['🧑‍🚒', 'alice', 'reaction', 'message#alice'],
  1177. ['👨‍🚒', 'alice', 'reaction', 'message#alice'],
  1178. ['👩‍✈️', 'alice', 'reaction', 'message#alice'],
  1179. ['🧑‍✈️', 'alice', 'reaction', 'message#alice'],
  1180. ['👨‍✈️', 'alice', 'reaction', 'message#alice'],
  1181. ['👩‍🚀', 'alice', 'reaction', 'message#alice'],
  1182. ['🧑‍🚀', 'alice', 'reaction', 'message#alice'],
  1183. ['👨‍🚀', 'alice', 'reaction', 'message#alice'],
  1184. ['👩‍⚖️', 'alice', 'reaction', 'message#alice'],
  1185. ['🧑‍⚖️', 'alice', 'reaction', 'message#alice'],
  1186. ['👨‍⚖️', 'alice', 'reaction', 'message#alice'],
  1187. ['👰‍♀️', 'alice', 'reaction', 'message#alice'],
  1188. ['👰', 'alice', 'reaction', 'message#alice'],
  1189. ['👰‍♂️', 'alice', 'reaction', 'message#alice'],
  1190. ['🤵‍♀️', 'alice', 'reaction', 'message#alice'],
  1191. ['🤵', 'alice', 'reaction', 'message#alice'],
  1192. ['🤵‍♂️', 'alice', 'reaction', 'message#alice'],
  1193. ['👸', 'alice', 'reaction', 'message#alice'],
  1194. ['🫅', 'alice', 'reaction', 'message#alice'],
  1195. ['🤴', 'alice', 'reaction', 'message#alice'],
  1196. ['🥷', 'alice', 'reaction', 'message#alice'],
  1197. ['🦸‍♀️', 'alice', 'reaction', 'message#alice'],
  1198. ['🦸', 'alice', 'reaction', 'message#alice'],
  1199. ['🦸‍♂️', 'alice', 'reaction', 'message#alice'],
  1200. ['🦹‍♀️', 'alice', 'reaction', 'message#alice'],
  1201. ['🦹', 'alice', 'reaction', 'message#alice'],
  1202. ['🦹‍♂️', 'alice', 'reaction', 'message#alice'],
  1203. ['🤶', 'alice', 'reaction', 'message#alice'],
  1204. ['🧑‍🎄', 'alice', 'reaction', 'message#alice'],
  1205. ['🎅', 'alice', 'reaction', 'message#alice'],
  1206. ['🧙‍♀️', 'alice', 'reaction', 'message#alice'],
  1207. ['🧙', 'alice', 'reaction', 'message#alice'],
  1208. ['🧙‍♂️', 'alice', 'reaction', 'message#alice'],
  1209. ['🧝‍♀️', 'alice', 'reaction', 'message#alice'],
  1210. ['🧝', 'alice', 'reaction', 'message#alice'],
  1211. ['🧝‍♂️', 'alice', 'reaction', 'message#alice'],
  1212. ['🧛‍♀️', 'alice', 'reaction', 'message#alice'],
  1213. ['🧛', 'alice', 'reaction', 'message#alice'],
  1214. ['🧛‍♂️', 'alice', 'reaction', 'message#alice'],
  1215. ['🧟‍♀️', 'alice', 'reaction', 'message#alice'],
  1216. ['🧟', 'alice', 'reaction', 'message#alice'],
  1217. ['🧟‍♂️', 'alice', 'reaction', 'message#alice'],
  1218. ['🧞‍♀️', 'alice', 'reaction', 'message#alice'],
  1219. ['🧞', 'alice', 'reaction', 'message#alice'],
  1220. ['🧞‍♂️', 'alice', 'reaction', 'message#alice'],
  1221. ['🧜‍♀️', 'alice', 'reaction', 'message#alice'],
  1222. ['🧜', 'alice', 'reaction', 'message#alice'],
  1223. ['🧜‍♂️', 'alice', 'reaction', 'message#alice'],
  1224. ['🧚‍♀️', 'alice', 'reaction', 'message#alice'],
  1225. ['🧚', 'alice', 'reaction', 'message#alice'],
  1226. ['🧚‍♂️', 'alice', 'reaction', 'message#alice'],
  1227. ['🧌', 'alice', 'reaction', 'message#alice'],
  1228. ['👼', 'alice', 'reaction', 'message#alice'],
  1229. ['🤰', 'alice', 'reaction', 'message#alice'],
  1230. ['🫄', 'alice', 'reaction', 'message#alice'],
  1231. ['🫃', 'alice', 'reaction', 'message#alice'],
  1232. ['🤱', 'alice', 'reaction', 'message#alice'],
  1233. ['👩‍🍼', 'alice', 'reaction', 'message#alice'],
  1234. ['🧑‍🍼', 'alice', 'reaction', 'message#alice'],
  1235. ['👨‍🍼', 'alice', 'reaction', 'message#alice'],
  1236. ['🙇‍♀️', 'alice', 'reaction', 'message#alice'],
  1237. ['🙇', 'alice', 'reaction', 'message#alice'],
  1238. ['🙇‍♂️', 'alice', 'reaction', 'message#alice'],
  1239. ['💁‍♀️', 'alice', 'reaction', 'message#alice'],
  1240. ['💁', 'alice', 'reaction', 'message#alice'],
  1241. ['💁‍♂️', 'alice', 'reaction', 'message#alice'],
  1242. ['🙅‍♀️', 'alice', 'reaction', 'message#alice'],
  1243. ['🙅', 'alice', 'reaction', 'message#alice'],
  1244. ['🙅‍♂️', 'alice', 'reaction', 'message#alice'],
  1245. ['🙆‍♀️', 'alice', 'reaction', 'message#alice'],
  1246. ['🙆', 'alice', 'reaction', 'message#alice'],
  1247. ['🙆‍♂️', 'alice', 'reaction', 'message#alice'],
  1248. ['🙋‍♀️', 'alice', 'reaction', 'message#alice'],
  1249. ['🙋', 'alice', 'reaction', 'message#alice'],
  1250. ['🙋‍♂️', 'alice', 'reaction', 'message#alice'],
  1251. ['🧏‍♀️', 'alice', 'reaction', 'message#alice'],
  1252. ['🧏', 'alice', 'reaction', 'message#alice'],
  1253. ['🧏‍♂️', 'alice', 'reaction', 'message#alice'],
  1254. ['🤦‍♀️', 'alice', 'reaction', 'message#alice'],
  1255. ['🤦', 'alice', 'reaction', 'message#alice'],
  1256. ['🤦‍♂️', 'alice', 'reaction', 'message#alice'],
  1257. ['🤷‍♀️', 'alice', 'reaction', 'message#alice'],
  1258. ['🤷', 'alice', 'reaction', 'message#alice'],
  1259. ['🤷‍♂️', 'alice', 'reaction', 'message#alice'],
  1260. ['🙎‍♀️', 'alice', 'reaction', 'message#alice'],
  1261. ['🙎', 'alice', 'reaction', 'message#alice'],
  1262. ['🙎‍♂️', 'alice', 'reaction', 'message#alice'],
  1263. ['🙍‍♀️', 'alice', 'reaction', 'message#alice'],
  1264. ['🙍', 'alice', 'reaction', 'message#alice'],
  1265. ['🙍‍♂️', 'alice', 'reaction', 'message#alice'],
  1266. ['💇‍♀️', 'alice', 'reaction', 'message#alice'],
  1267. ['💇', 'alice', 'reaction', 'message#alice'],
  1268. ['💇‍♂️', 'alice', 'reaction', 'message#alice'],
  1269. ['💆‍♀️', 'alice', 'reaction', 'message#alice'],
  1270. ['💆', 'alice', 'reaction', 'message#alice'],
  1271. ['💆‍♂️', 'alice', 'reaction', 'message#alice'],
  1272. ['🧖‍♀️', 'alice', 'reaction', 'message#alice'],
  1273. ['🧖', 'alice', 'reaction', 'message#alice'],
  1274. ['🧖‍♂️', 'alice', 'reaction', 'message#alice'],
  1275. ['💅', 'alice', 'reaction', 'message#alice'],
  1276. ['🤳', 'alice', 'reaction', 'message#alice'],
  1277. ['💃', 'alice', 'reaction', 'message#alice'],
  1278. ['🕺', 'alice', 'reaction', 'message#alice'],
  1279. ['👯‍♀️', 'alice', 'reaction', 'message#alice'],
  1280. ['👯', 'alice', 'reaction', 'message#alice'],
  1281. ['👯‍♂️', 'alice', 'reaction', 'message#alice'],
  1282. ['🕴', 'alice', 'reaction', 'message#alice'],
  1283. ['👩‍🦽', 'alice', 'reaction', 'message#alice'],
  1284. ['🧑‍🦽', 'alice', 'reaction', 'message#alice'],
  1285. ['👨‍🦽', 'alice', 'reaction', 'message#alice'],
  1286. ['👩‍🦼', 'alice', 'reaction', 'message#alice'],
  1287. ['🧑‍🦼', 'alice', 'reaction', 'message#alice'],
  1288. ['👨‍🦼', 'alice', 'reaction', 'message#alice'],
  1289. ['🚶‍♀️', 'alice', 'reaction', 'message#alice'],
  1290. ['🚶', 'alice', 'reaction', 'message#alice'],
  1291. ['🚶‍♂️', 'alice', 'reaction', 'message#alice'],
  1292. ['👩‍🦯', 'alice', 'reaction', 'message#alice'],
  1293. ['🧑‍🦯', 'alice', 'reaction', 'message#alice'],
  1294. ['👨‍🦯', 'alice', 'reaction', 'message#alice'],
  1295. ['🧎‍♀️', 'alice', 'reaction', 'message#alice'],
  1296. ['🧎', 'alice', 'reaction', 'message#alice'],
  1297. ['🧎‍♂️', 'alice', 'reaction', 'message#alice'],
  1298. ['🏃‍♀️', 'alice', 'reaction', 'message#alice'],
  1299. ['🏃', 'alice', 'reaction', 'message#alice'],
  1300. ['🏃‍♂️', 'alice', 'reaction', 'message#alice'],
  1301. ['🧍‍♀️', 'alice', 'reaction', 'message#alice'],
  1302. ['🧍', 'alice', 'reaction', 'message#alice'],
  1303. ['🧍‍♂️', 'alice', 'reaction', 'message#alice'],
  1304. ['👭', 'alice', 'reaction', 'message#alice'],
  1305. ['🧑‍🤝‍🧑', 'alice', 'reaction', 'message#alice'],
  1306. ['👬', 'alice', 'reaction', 'message#alice'],
  1307. ['👫', 'alice', 'reaction', 'message#alice'],
  1308. ['👩‍❤️‍👩', 'alice', 'reaction', 'message#alice'],
  1309. ['💑', 'alice', 'reaction', 'message#alice'],
  1310. ['👨‍❤️‍👨', 'alice', 'reaction', 'message#alice'],
  1311. ['👩‍❤️‍👨', 'alice', 'reaction', 'message#alice'],
  1312. ['👩‍❤️‍💋‍👩', 'alice', 'reaction', 'message#alice'],
  1313. ['💏', 'alice', 'reaction', 'message#alice'],
  1314. ['👨‍❤️‍💋‍👨', 'alice', 'reaction', 'message#alice'],
  1315. ['👩‍❤️‍💋‍👨', 'alice', 'reaction', 'message#alice'],
  1316. ['👪', 'alice', 'reaction', 'message#alice'],
  1317. ['👨‍👩‍👦', 'alice', 'reaction', 'message#alice'],
  1318. ['👨‍👩‍👧', 'alice', 'reaction', 'message#alice'],
  1319. ['👨‍👩‍👧‍👦', 'alice', 'reaction', 'message#alice'],
  1320. ['👨‍👩‍👦‍👦', 'alice', 'reaction', 'message#alice'],
  1321. ['👨‍👩‍👧‍👧', 'alice', 'reaction', 'message#alice'],
  1322. ['👨‍👨‍👦', 'alice', 'reaction', 'message#alice'],
  1323. ['👨‍👨‍👧', 'alice', 'reaction', 'message#alice'],
  1324. ['👨‍👨‍👧‍👦', 'alice', 'reaction', 'message#alice'],
  1325. ['👨‍👨‍👦‍👦', 'alice', 'reaction', 'message#alice'],
  1326. ['👨‍👨‍👧‍👧', 'alice', 'reaction', 'message#alice'],
  1327. ['👩‍👩‍👦', 'alice', 'reaction', 'message#alice'],
  1328. ['👩‍👩‍👧', 'alice', 'reaction', 'message#alice'],
  1329. ['👩‍👩‍👧‍👦', 'alice', 'reaction', 'message#alice'],
  1330. ['👩‍👩‍👦‍👦', 'alice', 'reaction', 'message#alice'],
  1331. ['👩‍👩‍👧‍👧', 'alice', 'reaction', 'message#alice'],
  1332. ['👨‍👦', 'alice', 'reaction', 'message#alice'],
  1333. ['👨‍👦‍👦', 'alice', 'reaction', 'message#alice'],
  1334. ['👨‍👧', 'alice', 'reaction', 'message#alice'],
  1335. ['👨‍👧‍👦', 'alice', 'reaction', 'message#alice'],
  1336. ['👨‍👧‍👧', 'alice', 'reaction', 'message#alice'],
  1337. ['👩‍👦', 'alice', 'reaction', 'message#alice'],
  1338. ['👩‍👦‍👦', 'alice', 'reaction', 'message#alice'],
  1339. ['👩‍👧', 'alice', 'reaction', 'message#alice'],
  1340. ['👩‍👧‍👦', 'alice', 'reaction', 'message#alice'],
  1341. ['👩‍👧‍👧', 'alice', 'reaction', 'message#alice'],
  1342. ['🗣', 'alice', 'reaction', 'message#alice'],
  1343. ['👤', 'alice', 'reaction', 'message#alice'],
  1344. ['👥', 'alice', 'reaction', 'message#alice'],
  1345. ['🫂', 'alice', 'reaction', 'message#alice'],
  1346. ['👋🏽', 'alice', 'reaction', 'message#alice'],
  1347. ['🤚🏽', 'alice', 'reaction', 'message#alice'],
  1348. ['🖐🏽', 'alice', 'reaction', 'message#alice'],
  1349. ['✋🏽', 'alice', 'reaction', 'message#alice'],
  1350. ['🖖🏽', 'alice', 'reaction', 'message#alice'],
  1351. ['👌🏽', 'alice', 'reaction', 'message#alice'],
  1352. ['🤌🏽', 'alice', 'reaction', 'message#alice'],
  1353. ['🤏🏽', 'alice', 'reaction', 'message#alice'],
  1354. ['✌🏽', 'alice', 'reaction', 'message#alice'],
  1355. ['🤞🏽', 'alice', 'reaction', 'message#alice'],
  1356. ['🫰🏽', 'alice', 'reaction', 'message#alice'],
  1357. ['🤟🏽', 'alice', 'reaction', 'message#alice'],
  1358. ['🤘🏽', 'alice', 'reaction', 'message#alice'],
  1359. ['🤙🏽', 'alice', 'reaction', 'message#alice'],
  1360. ['🫵🏽', 'alice', 'reaction', 'message#alice'],
  1361. ['🫱🏽', 'alice', 'reaction', 'message#alice'],
  1362. ['🫲🏽', 'alice', 'reaction', 'message#alice'],
  1363. ['🫳🏽', 'alice', 'reaction', 'message#alice'],
  1364. ['🫴🏽', 'alice', 'reaction', 'message#alice'],
  1365. ['👈🏽', 'alice', 'reaction', 'message#alice'],
  1366. ['👉🏽', 'alice', 'reaction', 'message#alice'],
  1367. ['👆🏽', 'alice', 'reaction', 'message#alice'],
  1368. ['🖕🏽', 'alice', 'reaction', 'message#alice'],
  1369. ['👇🏽', 'alice', 'reaction', 'message#alice'],
  1370. ['☝🏽', 'alice', 'reaction', 'message#alice'],
  1371. ['👍🏽', 'alice', 'reaction', 'message#alice'],
  1372. ['👎🏽', 'alice', 'reaction', 'message#alice'],
  1373. ['✊🏽', 'alice', 'reaction', 'message#alice'],
  1374. ['👊🏽', 'alice', 'reaction', 'message#alice'],
  1375. ['🤛🏽', 'alice', 'reaction', 'message#alice'],
  1376. ['🤜🏽', 'alice', 'reaction', 'message#alice'],
  1377. ['👏🏽', 'alice', 'reaction', 'message#alice'],
  1378. ['🫶🏽', 'alice', 'reaction', 'message#alice'],
  1379. ['🙌🏽', 'alice', 'reaction', 'message#alice'],
  1380. ['👐🏽', 'alice', 'reaction', 'message#alice'],
  1381. ['🤲🏽', 'alice', 'reaction', 'message#alice'],
  1382. ['🙏🏽', 'alice', 'reaction', 'message#alice'],
  1383. ['✍🏽', 'alice', 'reaction', 'message#alice'],
  1384. ['💅🏽', 'alice', 'reaction', 'message#alice'],
  1385. ['🤳🏽', 'alice', 'reaction', 'message#alice'],
  1386. ['💪🏽', 'alice', 'reaction', 'message#alice'],
  1387. ['🦵🏽', 'alice', 'reaction', 'message#alice'],
  1388. ['🦶🏽', 'alice', 'reaction', 'message#alice'],
  1389. ['👂🏽', 'alice', 'reaction', 'message#alice'],
  1390. ['🦻🏽', 'alice', 'reaction', 'message#alice'],
  1391. ['👃🏽', 'alice', 'reaction', 'message#alice'],
  1392. ['👶🏽', 'alice', 'reaction', 'message#alice'],
  1393. ['👧🏽', 'alice', 'reaction', 'message#alice'],
  1394. ['🧒🏽', 'alice', 'reaction', 'message#alice'],
  1395. ['👦🏽', 'alice', 'reaction', 'message#alice'],
  1396. ['👩🏽', 'alice', 'reaction', 'message#alice'],
  1397. ['🧑🏽', 'alice', 'reaction', 'message#alice'],
  1398. ['👨🏽', 'alice', 'reaction', 'message#alice'],
  1399. ['👩🏽‍🦱', 'alice', 'reaction', 'message#alice'],
  1400. ['🧑🏽‍🦱', 'alice', 'reaction', 'message#alice'],
  1401. ['👨🏽‍🦱', 'alice', 'reaction', 'message#alice'],
  1402. ['👩🏽‍🦰', 'alice', 'reaction', 'message#alice'],
  1403. ['🧑🏽‍🦰', 'alice', 'reaction', 'message#alice'],
  1404. ['👨🏽‍🦰', 'alice', 'reaction', 'message#alice'],
  1405. ['👱🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1406. ['👱🏽', 'alice', 'reaction', 'message#alice'],
  1407. ['👱🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1408. ['👩🏽‍🦳', 'alice', 'reaction', 'message#alice'],
  1409. ['🧑🏽‍🦳', 'alice', 'reaction', 'message#alice'],
  1410. ['👨🏽‍🦳', 'alice', 'reaction', 'message#alice'],
  1411. ['👩🏽‍🦲', 'alice', 'reaction', 'message#alice'],
  1412. ['🧑🏽‍🦲', 'alice', 'reaction', 'message#alice'],
  1413. ['👨🏽‍🦲', 'alice', 'reaction', 'message#alice'],
  1414. ['🧔🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1415. ['🧔🏽', 'alice', 'reaction', 'message#alice'],
  1416. ['🧔🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1417. ['👵🏽', 'alice', 'reaction', 'message#alice'],
  1418. ['🧓🏽', 'alice', 'reaction', 'message#alice'],
  1419. ['👴🏽', 'alice', 'reaction', 'message#alice'],
  1420. ['👲🏽', 'alice', 'reaction', 'message#alice'],
  1421. ['👳🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1422. ['👳🏽', 'alice', 'reaction', 'message#alice'],
  1423. ['👳🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1424. ['🧕🏽', 'alice', 'reaction', 'message#alice'],
  1425. ['👮🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1426. ['👮🏽', 'alice', 'reaction', 'message#alice'],
  1427. ['👮🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1428. ['👷🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1429. ['👷🏽', 'alice', 'reaction', 'message#alice'],
  1430. ['👷🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1431. ['💂🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1432. ['💂🏽', 'alice', 'reaction', 'message#alice'],
  1433. ['💂🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1434. ['🕵🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1435. ['🕵🏽', 'alice', 'reaction', 'message#alice'],
  1436. ['🕵🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1437. ['👩🏽‍⚕️', 'alice', 'reaction', 'message#alice'],
  1438. ['🧑🏽‍⚕️', 'alice', 'reaction', 'message#alice'],
  1439. ['👨🏽‍⚕️', 'alice', 'reaction', 'message#alice'],
  1440. ['👩🏽‍🌾', 'alice', 'reaction', 'message#alice'],
  1441. ['🧑🏽‍🌾', 'alice', 'reaction', 'message#alice'],
  1442. ['👨🏽‍🌾', 'alice', 'reaction', 'message#alice'],
  1443. ['👩🏽‍🍳', 'alice', 'reaction', 'message#alice'],
  1444. ['🧑🏽‍🍳', 'alice', 'reaction', 'message#alice'],
  1445. ['👨🏽‍🍳', 'alice', 'reaction', 'message#alice'],
  1446. ['👩🏽‍🎓', 'alice', 'reaction', 'message#alice'],
  1447. ['🧑🏽‍🎓', 'alice', 'reaction', 'message#alice'],
  1448. ['👨🏽‍🎓', 'alice', 'reaction', 'message#alice'],
  1449. ['👩🏽‍🎤', 'alice', 'reaction', 'message#alice'],
  1450. ['🧑🏽‍🎤', 'alice', 'reaction', 'message#alice'],
  1451. ['👨🏽‍🎤', 'alice', 'reaction', 'message#alice'],
  1452. ['👩🏽‍🏫', 'alice', 'reaction', 'message#alice'],
  1453. ['🧑🏽‍🏫', 'alice', 'reaction', 'message#alice'],
  1454. ['👨🏽‍🏫', 'alice', 'reaction', 'message#alice'],
  1455. ['👩🏽‍🏭', 'alice', 'reaction', 'message#alice'],
  1456. ['🧑🏽‍🏭', 'alice', 'reaction', 'message#alice'],
  1457. ['👨🏽‍🏭', 'alice', 'reaction', 'message#alice'],
  1458. ['👩🏽‍💻', 'alice', 'reaction', 'message#alice'],
  1459. ['🧑🏽‍💻', 'alice', 'reaction', 'message#alice'],
  1460. ['👨🏽‍💻', 'alice', 'reaction', 'message#alice'],
  1461. ['👩🏽‍💼', 'alice', 'reaction', 'message#alice'],
  1462. ['🧑🏽‍💼', 'alice', 'reaction', 'message#alice'],
  1463. ['👨🏽‍💼', 'alice', 'reaction', 'message#alice'],
  1464. ['👩🏽‍🔧', 'alice', 'reaction', 'message#alice'],
  1465. ['🧑🏽‍🔧', 'alice', 'reaction', 'message#alice'],
  1466. ['👨🏽‍🔧', 'alice', 'reaction', 'message#alice'],
  1467. ['👩🏽‍🔬', 'alice', 'reaction', 'message#alice'],
  1468. ['🧑🏽‍🔬', 'alice', 'reaction', 'message#alice'],
  1469. ['👨🏽‍🔬', 'alice', 'reaction', 'message#alice'],
  1470. ['👩🏽‍🎨', 'alice', 'reaction', 'message#alice'],
  1471. ['🧑🏽‍🎨', 'alice', 'reaction', 'message#alice'],
  1472. ['👨🏽‍🎨', 'alice', 'reaction', 'message#alice'],
  1473. ['👩🏽‍🚒', 'alice', 'reaction', 'message#alice'],
  1474. ['🧑🏽‍🚒', 'alice', 'reaction', 'message#alice'],
  1475. ['👨🏽‍🚒', 'alice', 'reaction', 'message#alice'],
  1476. ['👩🏽‍✈️', 'alice', 'reaction', 'message#alice'],
  1477. ['🧑🏽‍✈️', 'alice', 'reaction', 'message#alice'],
  1478. ['👨🏽‍✈️', 'alice', 'reaction', 'message#alice'],
  1479. ['👩🏽‍🚀', 'alice', 'reaction', 'message#alice'],
  1480. ['🧑🏽‍🚀', 'alice', 'reaction', 'message#alice'],
  1481. ['👨🏽‍🚀', 'alice', 'reaction', 'message#alice'],
  1482. ['👩🏽‍⚖️', 'alice', 'reaction', 'message#alice'],
  1483. ['🧑🏽‍⚖️', 'alice', 'reaction', 'message#alice'],
  1484. ['👨🏽‍⚖️', 'alice', 'reaction', 'message#alice'],
  1485. ['👰🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1486. ['👰🏽', 'alice', 'reaction', 'message#alice'],
  1487. ['👰🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1488. ['🤵🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1489. ['🤵🏽', 'alice', 'reaction', 'message#alice'],
  1490. ['🤵🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1491. ['👸🏽', 'alice', 'reaction', 'message#alice'],
  1492. ['🫅🏽', 'alice', 'reaction', 'message#alice'],
  1493. ['🤴🏽', 'alice', 'reaction', 'message#alice'],
  1494. ['🥷🏽', 'alice', 'reaction', 'message#alice'],
  1495. ['🦸🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1496. ['🦸🏽', 'alice', 'reaction', 'message#alice'],
  1497. ['🦸🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1498. ['🦹🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1499. ['🦹🏽', 'alice', 'reaction', 'message#alice'],
  1500. ['🦹🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1501. ['🤶🏽', 'alice', 'reaction', 'message#alice'],
  1502. ['🧑🏽‍🎄', 'alice', 'reaction', 'message#alice'],
  1503. ['🎅🏽', 'alice', 'reaction', 'message#alice'],
  1504. ['🧙🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1505. ['🧙🏽', 'alice', 'reaction', 'message#alice'],
  1506. ['🧙🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1507. ['🧝🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1508. ['🧝🏽', 'alice', 'reaction', 'message#alice'],
  1509. ['🧝🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1510. ['🧛🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1511. ['🧛🏽', 'alice', 'reaction', 'message#alice'],
  1512. ['🧛🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1513. ['🧜🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1514. ['🧜🏽', 'alice', 'reaction', 'message#alice'],
  1515. ['🧜🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1516. ['🧚🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1517. ['🧚🏽', 'alice', 'reaction', 'message#alice'],
  1518. ['🧚🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1519. ['👼🏽', 'alice', 'reaction', 'message#alice'],
  1520. ['🤰🏽', 'alice', 'reaction', 'message#alice'],
  1521. ['🫄🏽', 'alice', 'reaction', 'message#alice'],
  1522. ['🫃🏽', 'alice', 'reaction', 'message#alice'],
  1523. ['🤱🏽', 'alice', 'reaction', 'message#alice'],
  1524. ['👩🏽‍🍼', 'alice', 'reaction', 'message#alice'],
  1525. ['🧑🏽‍🍼', 'alice', 'reaction', 'message#alice'],
  1526. ['👨🏽‍🍼', 'alice', 'reaction', 'message#alice'],
  1527. ['🙇🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1528. ['🙇🏽', 'alice', 'reaction', 'message#alice'],
  1529. ['🙇🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1530. ['💁🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1531. ['💁🏽', 'alice', 'reaction', 'message#alice'],
  1532. ['💁🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1533. ['🙅🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1534. ['🙅🏽', 'alice', 'reaction', 'message#alice'],
  1535. ['🙅🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1536. ['🙆🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1537. ['🙆🏽', 'alice', 'reaction', 'message#alice'],
  1538. ['🙆🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1539. ['🙋🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1540. ['🙋🏽', 'alice', 'reaction', 'message#alice'],
  1541. ['🙋🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1542. ['🧏🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1543. ['🧏🏽', 'alice', 'reaction', 'message#alice'],
  1544. ['🧏🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1545. ['🤦🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1546. ['🤦🏽', 'alice', 'reaction', 'message#alice'],
  1547. ['🤦🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1548. ['🤷🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1549. ['🤷🏽', 'alice', 'reaction', 'message#alice'],
  1550. ['🤷🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1551. ['🙎🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1552. ['🙎🏽', 'alice', 'reaction', 'message#alice'],
  1553. ['🙎🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1554. ['🙍🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1555. ['🙍🏽', 'alice', 'reaction', 'message#alice'],
  1556. ['🙍🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1557. ['💇🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1558. ['💇🏽', 'alice', 'reaction', 'message#alice'],
  1559. ['💇🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1560. ['💆🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1561. ['💆🏽', 'alice', 'reaction', 'message#alice'],
  1562. ['💆🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1563. ['🧖🏽‍♀️', 'alice', 'reaction', 'message#alice'],
  1564. ['🧖🏽', 'alice', 'reaction', 'message#alice'],
  1565. ['🧖🏽‍♂️', 'alice', 'reaction', 'message#alice'],
  1566. ['💃🏽', 'alice', 'reaction', 'message#alice'],
  1567. ['🕺🏽', 'alice', 'reaction', 'message#alice'],
  1568. ['🕴🏽', 'alice', 'reaction', 'message#alice'],
  1569. ['👩🏽‍🦽', 'alice', 'reaction', 'message#alice'],
  1570. ['🧑🏽‍🦽', 'alice', 'reaction', 'message#alice'],
  1571. ],
  1572. [
  1573. ['😀', 'alice'],
  1574. ['😃', 'alice'],
  1575. ['😄', 'alice'],
  1576. ['😁', 'alice'],
  1577. ['😆', 'alice'],
  1578. ['😅', 'alice'],
  1579. ['😂', 'alice'],
  1580. ['🤣', 'alice'],
  1581. ['🥲', 'alice'],
  1582. ['🥹', 'alice'],
  1583. ['☺️', 'alice'],
  1584. ['😊', 'alice'],
  1585. ['😇', 'alice'],
  1586. ['🙂', 'alice'],
  1587. ['🙃', 'alice'],
  1588. ['😉', 'alice'],
  1589. ['😌', 'alice'],
  1590. ['😍', 'alice'],
  1591. ['🥰', 'alice'],
  1592. ['😘', 'alice'],
  1593. ['😗', 'alice'],
  1594. ['😙', 'alice'],
  1595. ['😚', 'alice'],
  1596. ['😋', 'alice'],
  1597. ['😛', 'alice'],
  1598. ['😝', 'alice'],
  1599. ['😜', 'alice'],
  1600. ['🤪', 'alice'],
  1601. ['🤨', 'alice'],
  1602. ['🧐', 'alice'],
  1603. ['🤓', 'alice'],
  1604. ['😎', 'alice'],
  1605. ['🥸', 'alice'],
  1606. ['🤩', 'alice'],
  1607. ['🥳', 'alice'],
  1608. ['😏', 'alice'],
  1609. ['😒', 'alice'],
  1610. ['😞', 'alice'],
  1611. ['😔', 'alice'],
  1612. ['😟', 'alice'],
  1613. ['😕', 'alice'],
  1614. ['🙁', 'alice'],
  1615. ['☹️', 'alice'],
  1616. ['😣', 'alice'],
  1617. ['😖', 'alice'],
  1618. ['😫', 'alice'],
  1619. ['😩', 'alice'],
  1620. ['🥺', 'alice'],
  1621. ['😢', 'alice'],
  1622. ['😭', 'alice'],
  1623. ['😮‍💨', 'alice'],
  1624. ['😤', 'alice'],
  1625. ['😠', 'alice'],
  1626. ['😡', 'alice'],
  1627. ['🤬', 'alice'],
  1628. ['🤯', 'alice'],
  1629. ['😳', 'alice'],
  1630. ['🥵', 'alice'],
  1631. ['🥶', 'alice'],
  1632. ['😱', 'alice'],
  1633. ['😨', 'alice'],
  1634. ['😰', 'alice'],
  1635. ['😥', 'alice'],
  1636. ['😓', 'alice'],
  1637. ['🫣', 'alice'],
  1638. ['🤗', 'alice'],
  1639. ['🫡', 'alice'],
  1640. ['🤔', 'alice'],
  1641. ['🫢', 'alice'],
  1642. ['🤭', 'alice'],
  1643. ['🤫', 'alice'],
  1644. ['🤥', 'alice'],
  1645. ['😶', 'alice'],
  1646. ['😶‍🌫️', 'alice'],
  1647. ['😐', 'alice'],
  1648. ['😑', 'alice'],
  1649. ['😬', 'alice'],
  1650. ['🫠', 'alice'],
  1651. ['🙄', 'alice'],
  1652. ['😯', 'alice'],
  1653. ['😦', 'alice'],
  1654. ['😧', 'alice'],
  1655. ['😮', 'alice'],
  1656. ['😲', 'alice'],
  1657. ['🥱', 'alice'],
  1658. ['😴', 'alice'],
  1659. ['🤤', 'alice'],
  1660. ['😪', 'alice'],
  1661. ['😵', 'alice'],
  1662. ['😵‍💫', 'alice'],
  1663. ['🫥', 'alice'],
  1664. ['🤐', 'alice'],
  1665. ['🥴', 'alice'],
  1666. ['🤢', 'alice'],
  1667. ['🤮', 'alice'],
  1668. ['🤧', 'alice'],
  1669. ['😷', 'alice'],
  1670. ['🤒', 'alice'],
  1671. ['🤕', 'alice'],
  1672. ['🤑', 'alice'],
  1673. ['🤠', 'alice'],
  1674. ['😈', 'alice'],
  1675. ['👿', 'alice'],
  1676. ['👹', 'alice'],
  1677. ['👺', 'alice'],
  1678. ['🤡', 'alice'],
  1679. ['💩', 'alice'],
  1680. ['👻', 'alice'],
  1681. ['💀', 'alice'],
  1682. ['☠️', 'alice'],
  1683. ['👽', 'alice'],
  1684. ['👾', 'alice'],
  1685. ['🤖', 'alice'],
  1686. ['🎃', 'alice'],
  1687. ['😺', 'alice'],
  1688. ['😸', 'alice'],
  1689. ['😹', 'alice'],
  1690. ['😻', 'alice'],
  1691. ['😼', 'alice'],
  1692. ['😽', 'alice'],
  1693. ['🙀', 'alice'],
  1694. ['😿', 'alice'],
  1695. ['😾', 'alice'],
  1696. ['👶', 'alice'],
  1697. ['👧', 'alice'],
  1698. ['🧒', 'alice'],
  1699. ['👦', 'alice'],
  1700. ['👩', 'alice'],
  1701. ['🧑', 'alice'],
  1702. ['👨', 'alice'],
  1703. ['👩‍🦱', 'alice'],
  1704. ['🧑‍🦱', 'alice'],
  1705. ['👨‍🦱', 'alice'],
  1706. ['👩‍🦰', 'alice'],
  1707. ['🧑‍🦰', 'alice'],
  1708. ['👨‍🦰', 'alice'],
  1709. ['👱‍♀️', 'alice'],
  1710. ['👱', 'alice'],
  1711. ['👱‍♂️', 'alice'],
  1712. ['👩‍🦳', 'alice'],
  1713. ['🧑‍🦳', 'alice'],
  1714. ['👨‍🦳', 'alice'],
  1715. ['👩‍🦲', 'alice'],
  1716. ['🧑‍🦲', 'alice'],
  1717. ['👨‍🦲', 'alice'],
  1718. ['🧔‍♀️', 'alice'],
  1719. ['🧔', 'alice'],
  1720. ['🧔‍♂️', 'alice'],
  1721. ['👵', 'alice'],
  1722. ['🧓', 'alice'],
  1723. ['👴', 'alice'],
  1724. ['👲', 'alice'],
  1725. ['👳‍♀️', 'alice'],
  1726. ['👳', 'alice'],
  1727. ['👳‍♂️', 'alice'],
  1728. ['🧕', 'alice'],
  1729. ['👮‍♀️', 'alice'],
  1730. ['👮', 'alice'],
  1731. ['👮‍♂️', 'alice'],
  1732. ['👷‍♀️', 'alice'],
  1733. ['👷', 'alice'],
  1734. ['👷‍♂️', 'alice'],
  1735. ['💂‍♀️', 'alice'],
  1736. ['💂', 'alice'],
  1737. ['💂‍♂️', 'alice'],
  1738. ['🕵️‍♀️', 'alice'],
  1739. ['🕵️', 'alice'],
  1740. ['🕵️‍♂️', 'alice'],
  1741. ['👩‍⚕️', 'alice'],
  1742. ['🧑‍⚕️', 'alice'],
  1743. ['👨‍⚕️', 'alice'],
  1744. ['👩‍🌾', 'alice'],
  1745. ['🧑‍🌾', 'alice'],
  1746. ['👨‍🌾', 'alice'],
  1747. ['👩‍🍳', 'alice'],
  1748. ['🧑‍🍳', 'alice'],
  1749. ['👨‍🍳', 'alice'],
  1750. ['👩‍🎓', 'alice'],
  1751. ['🧑‍🎓', 'alice'],
  1752. ['👨‍🎓', 'alice'],
  1753. ['👩‍🎤', 'alice'],
  1754. ['🧑‍🎤', 'alice'],
  1755. ['👨‍🎤', 'alice'],
  1756. ['👩‍🏫', 'alice'],
  1757. ['🧑‍🏫', 'alice'],
  1758. ['👨‍🏫', 'alice'],
  1759. ['👩‍🏭', 'alice'],
  1760. ['🧑‍🏭', 'alice'],
  1761. ['👨‍🏭', 'alice'],
  1762. ['👩‍💻', 'alice'],
  1763. ['🧑‍💻', 'alice'],
  1764. ['👨‍💻', 'alice'],
  1765. ['👩‍💼', 'alice'],
  1766. ['🧑‍💼', 'alice'],
  1767. ['👨‍💼', 'alice'],
  1768. ['👩‍🔧', 'alice'],
  1769. ['🧑‍🔧', 'alice'],
  1770. ['👨‍🔧', 'alice'],
  1771. ['👩‍🔬', 'alice'],
  1772. ['🧑‍🔬', 'alice'],
  1773. ['👨‍🔬', 'alice'],
  1774. ['👩‍🎨', 'alice'],
  1775. ['🧑‍🎨', 'alice'],
  1776. ['👨‍🎨', 'alice'],
  1777. ['👩‍🚒', 'alice'],
  1778. ['🧑‍🚒', 'alice'],
  1779. ['👨‍🚒', 'alice'],
  1780. ['👩‍✈️', 'alice'],
  1781. ['🧑‍✈️', 'alice'],
  1782. ['👨‍✈️', 'alice'],
  1783. ['👩‍🚀', 'alice'],
  1784. ['🧑‍🚀', 'alice'],
  1785. ['👨‍🚀', 'alice'],
  1786. ['👩‍⚖️', 'alice'],
  1787. ['🧑‍⚖️', 'alice'],
  1788. ['👨‍⚖️', 'alice'],
  1789. ['👰‍♀️', 'alice'],
  1790. ['👰', 'alice'],
  1791. ['👰‍♂️', 'alice'],
  1792. ['🤵‍♀️', 'alice'],
  1793. ['🤵', 'alice'],
  1794. ['🤵‍♂️', 'alice'],
  1795. ['👸', 'alice'],
  1796. ['🫅', 'alice'],
  1797. ['🤴', 'alice'],
  1798. ['🥷', 'alice'],
  1799. ['🦸‍♀️', 'alice'],
  1800. ['🦸', 'alice'],
  1801. ['🦸‍♂️', 'alice'],
  1802. ['🦹‍♀️', 'alice'],
  1803. ['🦹', 'alice'],
  1804. ['🦹‍♂️', 'alice'],
  1805. ['🤶', 'alice'],
  1806. ['🧑‍🎄', 'alice'],
  1807. ['🎅', 'alice'],
  1808. ['🧙‍♀️', 'alice'],
  1809. ['🧙', 'alice'],
  1810. ['🧙‍♂️', 'alice'],
  1811. ['🧝‍♀️', 'alice'],
  1812. ['🧝', 'alice'],
  1813. ['🧝‍♂️', 'alice'],
  1814. ['🧛‍♀️', 'alice'],
  1815. ['🧛', 'alice'],
  1816. ['🧛‍♂️', 'alice'],
  1817. ['🧟‍♀️', 'alice'],
  1818. ['🧟', 'alice'],
  1819. ['🧟‍♂️', 'alice'],
  1820. ['🧞‍♀️', 'alice'],
  1821. ['🧞', 'alice'],
  1822. ['🧞‍♂️', 'alice'],
  1823. ['🧜‍♀️', 'alice'],
  1824. ['🧜', 'alice'],
  1825. ['🧜‍♂️', 'alice'],
  1826. ['🧚‍♀️', 'alice'],
  1827. ['🧚', 'alice'],
  1828. ['🧚‍♂️', 'alice'],
  1829. ['🧌', 'alice'],
  1830. ['👼', 'alice'],
  1831. ['🤰', 'alice'],
  1832. ['🫄', 'alice'],
  1833. ['🫃', 'alice'],
  1834. ['🤱', 'alice'],
  1835. ['👩‍🍼', 'alice'],
  1836. ['🧑‍🍼', 'alice'],
  1837. ['👨‍🍼', 'alice'],
  1838. ['🙇‍♀️', 'alice'],
  1839. ['🙇', 'alice'],
  1840. ['🙇‍♂️', 'alice'],
  1841. ['💁‍♀️', 'alice'],
  1842. ['💁', 'alice'],
  1843. ['💁‍♂️', 'alice'],
  1844. ['🙅‍♀️', 'alice'],
  1845. ['🙅', 'alice'],
  1846. ['🙅‍♂️', 'alice'],
  1847. ['🙆‍♀️', 'alice'],
  1848. ['🙆', 'alice'],
  1849. ['🙆‍♂️', 'alice'],
  1850. ['🙋‍♀️', 'alice'],
  1851. ['🙋', 'alice'],
  1852. ['🙋‍♂️', 'alice'],
  1853. ['🧏‍♀️', 'alice'],
  1854. ['🧏', 'alice'],
  1855. ['🧏‍♂️', 'alice'],
  1856. ['🤦‍♀️', 'alice'],
  1857. ['🤦', 'alice'],
  1858. ['🤦‍♂️', 'alice'],
  1859. ['🤷‍♀️', 'alice'],
  1860. ['🤷', 'alice'],
  1861. ['🤷‍♂️', 'alice'],
  1862. ['🙎‍♀️', 'alice'],
  1863. ['🙎', 'alice'],
  1864. ['🙎‍♂️', 'alice'],
  1865. ['🙍‍♀️', 'alice'],
  1866. ['🙍', 'alice'],
  1867. ['🙍‍♂️', 'alice'],
  1868. ['💇‍♀️', 'alice'],
  1869. ['💇', 'alice'],
  1870. ['💇‍♂️', 'alice'],
  1871. ['💆‍♀️', 'alice'],
  1872. ['💆', 'alice'],
  1873. ['💆‍♂️', 'alice'],
  1874. ['🧖‍♀️', 'alice'],
  1875. ['🧖', 'alice'],
  1876. ['🧖‍♂️', 'alice'],
  1877. ['💅', 'alice'],
  1878. ['🤳', 'alice'],
  1879. ['💃', 'alice'],
  1880. ['🕺', 'alice'],
  1881. ['👯‍♀️', 'alice'],
  1882. ['👯', 'alice'],
  1883. ['👯‍♂️', 'alice'],
  1884. ['🕴', 'alice'],
  1885. ['👩‍🦽', 'alice'],
  1886. ['🧑‍🦽', 'alice'],
  1887. ['👨‍🦽', 'alice'],
  1888. ['👩‍🦼', 'alice'],
  1889. ['🧑‍🦼', 'alice'],
  1890. ['👨‍🦼', 'alice'],
  1891. ['🚶‍♀️', 'alice'],
  1892. ['🚶', 'alice'],
  1893. ['🚶‍♂️', 'alice'],
  1894. ['👩‍🦯', 'alice'],
  1895. ['🧑‍🦯', 'alice'],
  1896. ['👨‍🦯', 'alice'],
  1897. ['🧎‍♀️', 'alice'],
  1898. ['🧎', 'alice'],
  1899. ['🧎‍♂️', 'alice'],
  1900. ['🏃‍♀️', 'alice'],
  1901. ['🏃', 'alice'],
  1902. ['🏃‍♂️', 'alice'],
  1903. ['🧍‍♀️', 'alice'],
  1904. ['🧍', 'alice'],
  1905. ['🧍‍♂️', 'alice'],
  1906. ['👭', 'alice'],
  1907. ['🧑‍🤝‍🧑', 'alice'],
  1908. ['👬', 'alice'],
  1909. ['👫', 'alice'],
  1910. ['👩‍❤️‍👩', 'alice'],
  1911. ['💑', 'alice'],
  1912. ['👨‍❤️‍👨', 'alice'],
  1913. ['👩‍❤️‍👨', 'alice'],
  1914. ['👩‍❤️‍💋‍👩', 'alice'],
  1915. ['💏', 'alice'],
  1916. ['👨‍❤️‍💋‍👨', 'alice'],
  1917. ['👩‍❤️‍💋‍👨', 'alice'],
  1918. ['👪', 'alice'],
  1919. ['👨‍👩‍👦', 'alice'],
  1920. ['👨‍👩‍👧', 'alice'],
  1921. ['👨‍👩‍👧‍👦', 'alice'],
  1922. ['👨‍👩‍👦‍👦', 'alice'],
  1923. ['👨‍👩‍👧‍👧', 'alice'],
  1924. ['👨‍👨‍👦', 'alice'],
  1925. ['👨‍👨‍👧', 'alice'],
  1926. ['👨‍👨‍👧‍👦', 'alice'],
  1927. ['👨‍👨‍👦‍👦', 'alice'],
  1928. ['👨‍👨‍👧‍👧', 'alice'],
  1929. ['👩‍👩‍👦', 'alice'],
  1930. ['👩‍👩‍👧', 'alice'],
  1931. ['👩‍👩‍👧‍👦', 'alice'],
  1932. ['👩‍👩‍👦‍👦', 'alice'],
  1933. ['👩‍👩‍👧‍👧', 'alice'],
  1934. ['👨‍👦', 'alice'],
  1935. ['👨‍👦‍👦', 'alice'],
  1936. ['👨‍👧', 'alice'],
  1937. ['👨‍👧‍👦', 'alice'],
  1938. ['👨‍👧‍👧', 'alice'],
  1939. ['👩‍👦', 'alice'],
  1940. ['👩‍👦‍👦', 'alice'],
  1941. ['👩‍👧', 'alice'],
  1942. ['👩‍👧‍👦', 'alice'],
  1943. ['👩‍👧‍👧', 'alice'],
  1944. ['🗣', 'alice'],
  1945. ['👤', 'alice'],
  1946. ['👥', 'alice'],
  1947. ['🫂', 'alice'],
  1948. ['👋🏽', 'alice'],
  1949. ['🤚🏽', 'alice'],
  1950. ['🖐🏽', 'alice'],
  1951. ['✋🏽', 'alice'],
  1952. ['🖖🏽', 'alice'],
  1953. ['👌🏽', 'alice'],
  1954. ['🤌🏽', 'alice'],
  1955. ['🤏🏽', 'alice'],
  1956. ['✌🏽', 'alice'],
  1957. ['🤞🏽', 'alice'],
  1958. ['🫰🏽', 'alice'],
  1959. ['🤟🏽', 'alice'],
  1960. ['🤘🏽', 'alice'],
  1961. ['🤙🏽', 'alice'],
  1962. ['🫵🏽', 'alice'],
  1963. ['🫱🏽', 'alice'],
  1964. ['🫲🏽', 'alice'],
  1965. ['🫳🏽', 'alice'],
  1966. ['🫴🏽', 'alice'],
  1967. ['👈🏽', 'alice'],
  1968. ['👉🏽', 'alice'],
  1969. ['👆🏽', 'alice'],
  1970. ['🖕🏽', 'alice'],
  1971. ['👇🏽', 'alice'],
  1972. ['☝🏽', 'alice'],
  1973. ['👍🏽', 'alice'],
  1974. ['👎🏽', 'alice'],
  1975. ['✊🏽', 'alice'],
  1976. ['👊🏽', 'alice'],
  1977. ['🤛🏽', 'alice'],
  1978. ['🤜🏽', 'alice'],
  1979. ['👏🏽', 'alice'],
  1980. ['🫶🏽', 'alice'],
  1981. ['🙌🏽', 'alice'],
  1982. ['👐🏽', 'alice'],
  1983. ['🤲🏽', 'alice'],
  1984. ['🙏🏽', 'alice'],
  1985. ['✍🏽', 'alice'],
  1986. ['💅🏽', 'alice'],
  1987. ['🤳🏽', 'alice'],
  1988. ['💪🏽', 'alice'],
  1989. ['🦵🏽', 'alice'],
  1990. ['🦶🏽', 'alice'],
  1991. ['👂🏽', 'alice'],
  1992. ['🦻🏽', 'alice'],
  1993. ['👃🏽', 'alice'],
  1994. ['👶🏽', 'alice'],
  1995. ['👧🏽', 'alice'],
  1996. ['🧒🏽', 'alice'],
  1997. ['👦🏽', 'alice'],
  1998. ['👩🏽', 'alice'],
  1999. ['🧑🏽', 'alice'],
  2000. ['👨🏽', 'alice'],
  2001. ['👩🏽‍🦱', 'alice'],
  2002. ['🧑🏽‍🦱', 'alice'],
  2003. ['👨🏽‍🦱', 'alice'],
  2004. ['👩🏽‍🦰', 'alice'],
  2005. ['🧑🏽‍🦰', 'alice'],
  2006. ['👨🏽‍🦰', 'alice'],
  2007. ['👱🏽‍♀️', 'alice'],
  2008. ['👱🏽', 'alice'],
  2009. ['👱🏽‍♂️', 'alice'],
  2010. ['👩🏽‍🦳', 'alice'],
  2011. ['🧑🏽‍🦳', 'alice'],
  2012. ['👨🏽‍🦳', 'alice'],
  2013. ['👩🏽‍🦲', 'alice'],
  2014. ['🧑🏽‍🦲', 'alice'],
  2015. ['👨🏽‍🦲', 'alice'],
  2016. ['🧔🏽‍♀️', 'alice'],
  2017. ['🧔🏽', 'alice'],
  2018. ['🧔🏽‍♂️', 'alice'],
  2019. ['👵🏽', 'alice'],
  2020. ['🧓🏽', 'alice'],
  2021. ['👴🏽', 'alice'],
  2022. ['👲🏽', 'alice'],
  2023. ['👳🏽‍♀️', 'alice'],
  2024. ['👳🏽', 'alice'],
  2025. ['👳🏽‍♂️', 'alice'],
  2026. ['🧕🏽', 'alice'],
  2027. ['👮🏽‍♀️', 'alice'],
  2028. ['👮🏽', 'alice'],
  2029. ['👮🏽‍♂️', 'alice'],
  2030. ['👷🏽‍♀️', 'alice'],
  2031. ['👷🏽', 'alice'],
  2032. ['👷🏽‍♂️', 'alice'],
  2033. ['💂🏽‍♀️', 'alice'],
  2034. ['💂🏽', 'alice'],
  2035. ['💂🏽‍♂️', 'alice'],
  2036. ['🕵🏽‍♀️', 'alice'],
  2037. ['🕵🏽', 'alice'],
  2038. ['🕵🏽‍♂️', 'alice'],
  2039. ['👩🏽‍⚕️', 'alice'],
  2040. ['🧑🏽‍⚕️', 'alice'],
  2041. ['👨🏽‍⚕️', 'alice'],
  2042. ['👩🏽‍🌾', 'alice'],
  2043. ['🧑🏽‍🌾', 'alice'],
  2044. ['👨🏽‍🌾', 'alice'],
  2045. ['👩🏽‍🍳', 'alice'],
  2046. ['🧑🏽‍🍳', 'alice'],
  2047. ['👨🏽‍🍳', 'alice'],
  2048. ['👩🏽‍🎓', 'alice'],
  2049. ['🧑🏽‍🎓', 'alice'],
  2050. ['👨🏽‍🎓', 'alice'],
  2051. ['👩🏽‍🎤', 'alice'],
  2052. ['🧑🏽‍🎤', 'alice'],
  2053. ['👨🏽‍🎤', 'alice'],
  2054. ['👩🏽‍🏫', 'alice'],
  2055. ['🧑🏽‍🏫', 'alice'],
  2056. ['👨🏽‍🏫', 'alice'],
  2057. ['👩🏽‍🏭', 'alice'],
  2058. ['🧑🏽‍🏭', 'alice'],
  2059. ['👨🏽‍🏭', 'alice'],
  2060. ['👩🏽‍💻', 'alice'],
  2061. ['🧑🏽‍💻', 'alice'],
  2062. ['👨🏽‍💻', 'alice'],
  2063. ['👩🏽‍💼', 'alice'],
  2064. ['🧑🏽‍💼', 'alice'],
  2065. ['👨🏽‍💼', 'alice'],
  2066. ['👩🏽‍🔧', 'alice'],
  2067. ['🧑🏽‍🔧', 'alice'],
  2068. ['👨🏽‍🔧', 'alice'],
  2069. ['👩🏽‍🔬', 'alice'],
  2070. ['🧑🏽‍🔬', 'alice'],
  2071. ['👨🏽‍🔬', 'alice'],
  2072. ['👩🏽‍🎨', 'alice'],
  2073. ['🧑🏽‍🎨', 'alice'],
  2074. ['👨🏽‍🎨', 'alice'],
  2075. ['👩🏽‍🚒', 'alice'],
  2076. ['🧑🏽‍🚒', 'alice'],
  2077. ['👨🏽‍🚒', 'alice'],
  2078. ['👩🏽‍✈️', 'alice'],
  2079. ['🧑🏽‍✈️', 'alice'],
  2080. ['👨🏽‍✈️', 'alice'],
  2081. ['👩🏽‍🚀', 'alice'],
  2082. ['🧑🏽‍🚀', 'alice'],
  2083. ['👨🏽‍🚀', 'alice'],
  2084. ['👩🏽‍⚖️', 'alice'],
  2085. ['🧑🏽‍⚖️', 'alice'],
  2086. ['👨🏽‍⚖️', 'alice'],
  2087. ['👰🏽‍♀️', 'alice'],
  2088. ['👰🏽', 'alice'],
  2089. ['👰🏽‍♂️', 'alice'],
  2090. ['🤵🏽‍♀️', 'alice'],
  2091. ['🤵🏽', 'alice'],
  2092. ['🤵🏽‍♂️', 'alice'],
  2093. ['👸🏽', 'alice'],
  2094. ['🫅🏽', 'alice'],
  2095. ['🤴🏽', 'alice'],
  2096. ['🥷🏽', 'alice'],
  2097. ['🦸🏽‍♀️', 'alice'],
  2098. ['🦸🏽', 'alice'],
  2099. ['🦸🏽‍♂️', 'alice'],
  2100. ['🦹🏽‍♀️', 'alice'],
  2101. ['🦹🏽', 'alice'],
  2102. ['🦹🏽‍♂️', 'alice'],
  2103. ['🤶🏽', 'alice'],
  2104. ['🧑🏽‍🎄', 'alice'],
  2105. ['🎅🏽', 'alice'],
  2106. ['🧙🏽‍♀️', 'alice'],
  2107. ['🧙🏽', 'alice'],
  2108. ['🧙🏽‍♂️', 'alice'],
  2109. ['🧝🏽‍♀️', 'alice'],
  2110. ['🧝🏽', 'alice'],
  2111. ['🧝🏽‍♂️', 'alice'],
  2112. ['🧛🏽‍♀️', 'alice'],
  2113. ['🧛🏽', 'alice'],
  2114. ['🧛🏽‍♂️', 'alice'],
  2115. ['🧜🏽‍♀️', 'alice'],
  2116. ['🧜🏽', 'alice'],
  2117. ['🧜🏽‍♂️', 'alice'],
  2118. ['🧚🏽‍♀️', 'alice'],
  2119. ['🧚🏽', 'alice'],
  2120. ['🧚🏽‍♂️', 'alice'],
  2121. ['👼🏽', 'alice'],
  2122. ['🤰🏽', 'alice'],
  2123. ['🫄🏽', 'alice'],
  2124. ['🫃🏽', 'alice'],
  2125. ['🤱🏽', 'alice'],
  2126. ['👩🏽‍🍼', 'alice'],
  2127. ['🧑🏽‍🍼', 'alice'],
  2128. ['👨🏽‍🍼', 'alice'],
  2129. ['🙇🏽‍♀️', 'alice'],
  2130. ['🙇🏽', 'alice'],
  2131. ['🙇🏽‍♂️', 'alice'],
  2132. ['💁🏽‍♀️', 'alice'],
  2133. ['💁🏽', 'alice'],
  2134. ['💁🏽‍♂️', 'alice'],
  2135. ['🙅🏽‍♀️', 'alice'],
  2136. ['🙅🏽', 'alice'],
  2137. ['🙅🏽‍♂️', 'alice'],
  2138. ['🙆🏽‍♀️', 'alice'],
  2139. ['🙆🏽', 'alice'],
  2140. ['🙆🏽‍♂️', 'alice'],
  2141. ['🙋🏽‍♀️', 'alice'],
  2142. ['🙋🏽', 'alice'],
  2143. ['🙋🏽‍♂️', 'alice'],
  2144. ['🧏🏽‍♀️', 'alice'],
  2145. ['🧏🏽', 'alice'],
  2146. ['🧏🏽‍♂️', 'alice'],
  2147. ['🤦🏽‍♀️', 'alice'],
  2148. ['🤦🏽', 'alice'],
  2149. ['🤦🏽‍♂️', 'alice'],
  2150. ['🤷🏽‍♀️', 'alice'],
  2151. ['🤷🏽', 'alice'],
  2152. ['🤷🏽‍♂️', 'alice'],
  2153. ['🙎🏽‍♀️', 'alice'],
  2154. ['🙎🏽', 'alice'],
  2155. ['🙎🏽‍♂️', 'alice'],
  2156. ['🙍🏽‍♀️', 'alice'],
  2157. ['🙍🏽', 'alice'],
  2158. ['🙍🏽‍♂️', 'alice'],
  2159. ['💇🏽‍♀️', 'alice'],
  2160. ['💇🏽', 'alice'],
  2161. ['💇🏽‍♂️', 'alice'],
  2162. ['💆🏽‍♀️', 'alice'],
  2163. ['💆🏽', 'alice'],
  2164. ['💆🏽‍♂️', 'alice'],
  2165. ['🧖🏽‍♀️', 'alice'],
  2166. ['🧖🏽', 'alice'],
  2167. ['🧖🏽‍♂️', 'alice'],
  2168. ['💃🏽', 'alice'],
  2169. ['🕺🏽', 'alice'],
  2170. ['🕴🏽', 'alice'],
  2171. ['👩🏽‍🦽', 'alice'],
  2172. ['🧑🏽‍🦽', 'alice'],
  2173. ],
  2174. ],
  2175. ];
  2176. }
  2177. /**
  2178. * @dataProvider providerTestRetrieveAllReactionsWithSpecificReaction
  2179. */
  2180. public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected) {
  2181. $this->skipIfNotSupport4ByteUTF();
  2182. $manager = $this->getManager();
  2183. $processedComments = $this->proccessComments($comments);
  2184. $comment = reset($processedComments);
  2185. $all = $manager->retrieveAllReactionsWithSpecificReaction($comment->getId(), $reaction);
  2186. $actual = array_map(function ($row) {
  2187. return [
  2188. 'message' => $row->getMessage(),
  2189. 'actorId' => $row->getActorId(),
  2190. ];
  2191. }, $all);
  2192. $this->assertEqualsCanonicalizing($expected, $actual);
  2193. }
  2194. public function providerTestRetrieveAllReactionsWithSpecificReaction(): array {
  2195. return [
  2196. [
  2197. [
  2198. ['message', 'alice', 'comment', null],
  2199. ],
  2200. '👎',
  2201. [],
  2202. ],
  2203. [
  2204. [
  2205. ['message', 'alice', 'comment', null],
  2206. ['👍', 'alice', 'reaction', 'message#alice'],
  2207. ['👍', 'frank', 'reaction', 'message#alice'],
  2208. ],
  2209. '👍',
  2210. [
  2211. ['👍', 'alice'],
  2212. ['👍', 'frank'],
  2213. ],
  2214. ],
  2215. [
  2216. [
  2217. ['message', 'alice', 'comment', null],
  2218. ['👍', 'alice', 'reaction', 'message#alice'],
  2219. ['👎', 'alice', 'reaction', 'message#alice'],
  2220. ['👍', 'frank', 'reaction', 'message#alice'],
  2221. ],
  2222. '👎',
  2223. [
  2224. ['👎', 'alice'],
  2225. ],
  2226. ],
  2227. ];
  2228. }
  2229. /**
  2230. * @dataProvider providerTestGetReactionComment
  2231. */
  2232. public function testGetReactionComment(array $comments, array $expected, bool $notFound) {
  2233. $this->skipIfNotSupport4ByteUTF();
  2234. $manager = $this->getManager();
  2235. $processedComments = $this->proccessComments($comments);
  2236. $keys = ['message', 'actorId', 'verb', 'parent'];
  2237. $expected = array_combine($keys, $expected);
  2238. if ($notFound) {
  2239. $this->expectException(\OCP\Comments\NotFoundException::class);
  2240. }
  2241. $comment = $processedComments[$expected['message'] . '#' . $expected['actorId']];
  2242. $actual = $manager->getReactionComment($comment->getParentId(), $comment->getActorType(), $comment->getActorId(), $comment->getMessage());
  2243. if (!$notFound) {
  2244. $this->assertEquals($expected['message'], $actual->getMessage());
  2245. $this->assertEquals($expected['actorId'], $actual->getActorId());
  2246. $this->assertEquals($expected['verb'], $actual->getVerb());
  2247. $this->assertEquals($processedComments[$expected['parent']]->getId(), $actual->getParentId());
  2248. }
  2249. }
  2250. public function providerTestGetReactionComment(): array {
  2251. return [
  2252. [
  2253. [
  2254. ['message', 'Matthew', 'comment', null],
  2255. ['👍', 'Matthew', 'reaction', 'message#Matthew'],
  2256. ['👍', 'Mark', 'reaction', 'message#Matthew'],
  2257. ['👍', 'Luke', 'reaction', 'message#Matthew'],
  2258. ['👍', 'John', 'reaction', 'message#Matthew'],
  2259. ],
  2260. ['👍', 'Matthew', 'reaction', 'message#Matthew'],
  2261. false,
  2262. ],
  2263. [
  2264. [
  2265. ['message', 'Matthew', 'comment', null],
  2266. ['👍', 'Matthew', 'reaction', 'message#Matthew'],
  2267. ['👍', 'Mark', 'reaction', 'message#Matthew'],
  2268. ['👍', 'Luke', 'reaction', 'message#Matthew'],
  2269. ['👍', 'John', 'reaction', 'message#Matthew'],
  2270. ],
  2271. ['👍', 'Mark', 'reaction', 'message#Matthew'],
  2272. false,
  2273. ],
  2274. [
  2275. [
  2276. ['message', 'Matthew', 'comment', null],
  2277. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2278. ],
  2279. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2280. false,
  2281. ],
  2282. [
  2283. [
  2284. ['message', 'Matthew', 'comment', null],
  2285. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2286. ['👎', 'Matthew', 'reaction_deleted', 'message#Matthew'],
  2287. ],
  2288. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2289. true,
  2290. ],
  2291. ];
  2292. }
  2293. /**
  2294. * @dataProvider providerTestReactionMessageSize
  2295. */
  2296. public function testReactionMessageSize($reactionString, $valid) {
  2297. $this->skipIfNotSupport4ByteUTF();
  2298. if (!$valid) {
  2299. $this->expectException(\UnexpectedValueException::class);
  2300. }
  2301. $manager = $this->getManager();
  2302. $comment = new Comment();
  2303. $comment->setMessage($reactionString)
  2304. ->setVerb('reaction')
  2305. ->setActor('users', 'alice')
  2306. ->setObject('files', 'file64');
  2307. $status = $manager->save($comment);
  2308. $this->assertTrue($status);
  2309. }
  2310. public function providerTestReactionMessageSize(): array {
  2311. return [
  2312. ['a', false],
  2313. ['1', false],
  2314. ['👍', true],
  2315. ['👍👍', false],
  2316. ['👍🏽', true],
  2317. ['👨🏽‍💻', true],
  2318. ['👨🏽‍💻👍', false],
  2319. ];
  2320. }
  2321. /**
  2322. * @dataProvider providerTestReactionsSummarizeOrdered
  2323. */
  2324. public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch) {
  2325. $this->skipIfNotSupport4ByteUTF();
  2326. $manager = $this->getManager();
  2327. $processedComments = $this->proccessComments($comments);
  2328. $comment = end($processedComments);
  2329. $actual = $manager->get($comment->getParentId());
  2330. if ($isFullMatch) {
  2331. $this->assertSame($expected, $actual->getReactions());
  2332. } else {
  2333. $subResult = array_slice($actual->getReactions(), 0, count($expected));
  2334. $this->assertSame($expected, $subResult);
  2335. }
  2336. }
  2337. public function providerTestReactionsSummarizeOrdered(): array {
  2338. return [
  2339. [
  2340. [
  2341. ['message', 'alice', 'comment', null],
  2342. ['👍', 'alice', 'reaction', 'message#alice'],
  2343. ],
  2344. ['👍' => 1],
  2345. true,
  2346. ],
  2347. [
  2348. [
  2349. ['message', 'alice', 'comment', null],
  2350. ['👎', 'John', 'reaction', 'message#alice'],
  2351. ['💼', 'Luke', 'reaction', 'message#alice'],
  2352. ['📋', 'Luke', 'reaction', 'message#alice'],
  2353. ['🚀', 'Luke', 'reaction', 'message#alice'],
  2354. ['🖤', 'Luke', 'reaction', 'message#alice'],
  2355. ['😜', 'Luke', 'reaction', 'message#alice'],
  2356. ['🌖', 'Luke', 'reaction', 'message#alice'],
  2357. ['💖', 'Luke', 'reaction', 'message#alice'],
  2358. ['📥', 'Luke', 'reaction', 'message#alice'],
  2359. ['🐉', 'Luke', 'reaction', 'message#alice'],
  2360. ['☕', 'Luke', 'reaction', 'message#alice'],
  2361. ['🐄', 'Luke', 'reaction', 'message#alice'],
  2362. ['🐕', 'Luke', 'reaction', 'message#alice'],
  2363. ['🐈', 'Luke', 'reaction', 'message#alice'],
  2364. ['🛂', 'Luke', 'reaction', 'message#alice'],
  2365. ['🕸', 'Luke', 'reaction', 'message#alice'],
  2366. ['🏰', 'Luke', 'reaction', 'message#alice'],
  2367. ['⚙️', 'Luke', 'reaction', 'message#alice'],
  2368. ['🚨', 'Luke', 'reaction', 'message#alice'],
  2369. ['👥', 'Luke', 'reaction', 'message#alice'],
  2370. ['👍', 'Paul', 'reaction', 'message#alice'],
  2371. ['👍', 'Peter', 'reaction', 'message#alice'],
  2372. ['💜', 'Matthew', 'reaction', 'message#alice'],
  2373. ['💜', 'Mark', 'reaction', 'message#alice'],
  2374. ['💜', 'Luke', 'reaction', 'message#alice'],
  2375. ],
  2376. [
  2377. '💜' => 3,
  2378. '👍' => 2,
  2379. ],
  2380. false,
  2381. ],
  2382. ];
  2383. }
  2384. }