ManagerTest.php 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601
  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\EventDispatcher\IEventDispatcher;
  17. use OCP\Files\Folder;
  18. use OCP\Files\IRootFolder;
  19. use OCP\IConfig;
  20. use OCP\IDBConnection;
  21. use OCP\IInitialStateService;
  22. use OCP\IUser;
  23. use OCP\Server;
  24. use Psr\Log\LoggerInterface;
  25. use Test\TestCase;
  26. /**
  27. * Class ManagerTest
  28. *
  29. * @group DB
  30. */
  31. class ManagerTest extends TestCase {
  32. /** @var IDBConnection */
  33. private $connection;
  34. /** @var \PHPUnit\Framework\MockObject\MockObject|IRootFolder */
  35. private $rootFolder;
  36. protected function setUp(): void {
  37. parent::setUp();
  38. $this->connection = \OC::$server->getDatabaseConnection();
  39. $this->rootFolder = $this->createMock(IRootFolder::class);
  40. $sql = $this->connection->getDatabasePlatform()->getTruncateTableSQL('`*PREFIX*comments`');
  41. $this->connection->prepare($sql)->execute();
  42. $sql = $this->connection->getDatabasePlatform()->getTruncateTableSQL('`*PREFIX*reactions`');
  43. $this->connection->prepare($sql)->execute();
  44. }
  45. protected function addDatabaseEntry($parentId, $topmostParentId, $creationDT = null, $latestChildDT = null, $objectId = null, $expireDate = null) {
  46. if (is_null($creationDT)) {
  47. $creationDT = new \DateTime();
  48. }
  49. if (is_null($latestChildDT)) {
  50. $latestChildDT = new \DateTime('yesterday');
  51. }
  52. if (is_null($objectId)) {
  53. $objectId = 'file64';
  54. }
  55. $qb = $this->connection->getQueryBuilder();
  56. $qb
  57. ->insert('comments')
  58. ->values([
  59. 'parent_id' => $qb->createNamedParameter($parentId),
  60. 'topmost_parent_id' => $qb->createNamedParameter($topmostParentId),
  61. 'children_count' => $qb->createNamedParameter(2),
  62. 'actor_type' => $qb->createNamedParameter('users'),
  63. 'actor_id' => $qb->createNamedParameter('alice'),
  64. 'message' => $qb->createNamedParameter('nice one'),
  65. 'verb' => $qb->createNamedParameter('comment'),
  66. 'creation_timestamp' => $qb->createNamedParameter($creationDT, 'datetime'),
  67. 'latest_child_timestamp' => $qb->createNamedParameter($latestChildDT, 'datetime'),
  68. 'object_type' => $qb->createNamedParameter('files'),
  69. 'object_id' => $qb->createNamedParameter($objectId),
  70. 'expire_date' => $qb->createNamedParameter($expireDate, 'datetime'),
  71. 'reference_id' => $qb->createNamedParameter('referenceId'),
  72. 'meta_data' => $qb->createNamedParameter(json_encode(['last_edit_actor_id' => 'admin'])),
  73. ])
  74. ->execute();
  75. return $qb->getLastInsertId();
  76. }
  77. protected function getManager() {
  78. return new Manager(
  79. $this->connection,
  80. $this->createMock(LoggerInterface::class),
  81. $this->createMock(IConfig::class),
  82. $this->createMock(ITimeFactory::class),
  83. new EmojiHelper($this->connection),
  84. $this->createMock(IInitialStateService::class),
  85. $this->rootFolder,
  86. $this->createMock(IEventDispatcher::class),
  87. );
  88. }
  89. public function testGetCommentNotFound(): void {
  90. $this->expectException(\OCP\Comments\NotFoundException::class);
  91. $manager = $this->getManager();
  92. $manager->get('22');
  93. }
  94. public function testGetCommentNotFoundInvalidInput(): void {
  95. $this->expectException(\InvalidArgumentException::class);
  96. $manager = $this->getManager();
  97. $manager->get('unexisting22');
  98. }
  99. public function testGetComment(): void {
  100. $manager = $this->getManager();
  101. $creationDT = new \DateTime();
  102. $latestChildDT = new \DateTime('yesterday');
  103. $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
  104. $qb
  105. ->insert('comments')
  106. ->values([
  107. 'parent_id' => $qb->createNamedParameter('2'),
  108. 'topmost_parent_id' => $qb->createNamedParameter('1'),
  109. 'children_count' => $qb->createNamedParameter(2),
  110. 'actor_type' => $qb->createNamedParameter('users'),
  111. 'actor_id' => $qb->createNamedParameter('alice'),
  112. 'message' => $qb->createNamedParameter('nice one'),
  113. 'verb' => $qb->createNamedParameter('comment'),
  114. 'creation_timestamp' => $qb->createNamedParameter($creationDT, 'datetime'),
  115. 'latest_child_timestamp' => $qb->createNamedParameter($latestChildDT, 'datetime'),
  116. 'object_type' => $qb->createNamedParameter('files'),
  117. 'object_id' => $qb->createNamedParameter('file64'),
  118. 'reference_id' => $qb->createNamedParameter('referenceId'),
  119. 'meta_data' => $qb->createNamedParameter(json_encode(['last_edit_actor_id' => 'admin'])),
  120. ])
  121. ->execute();
  122. $id = strval($qb->getLastInsertId());
  123. $comment = $manager->get($id);
  124. $this->assertTrue($comment instanceof IComment);
  125. $this->assertSame($comment->getId(), $id);
  126. $this->assertSame($comment->getParentId(), '2');
  127. $this->assertSame($comment->getTopmostParentId(), '1');
  128. $this->assertSame($comment->getChildrenCount(), 2);
  129. $this->assertSame($comment->getActorType(), 'users');
  130. $this->assertSame($comment->getActorId(), 'alice');
  131. $this->assertSame($comment->getMessage(), 'nice one');
  132. $this->assertSame($comment->getVerb(), 'comment');
  133. $this->assertSame($comment->getObjectType(), 'files');
  134. $this->assertSame($comment->getObjectId(), 'file64');
  135. $this->assertEquals($comment->getCreationDateTime()->getTimestamp(), $creationDT->getTimestamp());
  136. $this->assertEquals($comment->getLatestChildDateTime(), $latestChildDT);
  137. $this->assertEquals($comment->getReferenceId(), 'referenceId');
  138. $this->assertEquals($comment->getMetaData(), ['last_edit_actor_id' => 'admin']);
  139. }
  140. public function testGetTreeNotFound(): void {
  141. $this->expectException(\OCP\Comments\NotFoundException::class);
  142. $manager = $this->getManager();
  143. $manager->getTree('22');
  144. }
  145. public function testGetTreeNotFoundInvalidIpnut(): void {
  146. $this->expectException(\InvalidArgumentException::class);
  147. $manager = $this->getManager();
  148. $manager->getTree('unexisting22');
  149. }
  150. public function testGetTree(): void {
  151. $headId = $this->addDatabaseEntry(0, 0);
  152. $this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
  153. $this->addDatabaseEntry($headId, $headId, new \DateTime('-2 hours'));
  154. $id = $this->addDatabaseEntry($headId, $headId, new \DateTime('-1 hour'));
  155. $manager = $this->getManager();
  156. $tree = $manager->getTree($headId);
  157. // Verifying the root comment
  158. $this->assertTrue(isset($tree['comment']));
  159. $this->assertTrue($tree['comment'] instanceof IComment);
  160. $this->assertSame($tree['comment']->getId(), strval($headId));
  161. $this->assertTrue(isset($tree['replies']));
  162. $this->assertSame(count($tree['replies']), 3);
  163. // one level deep
  164. foreach ($tree['replies'] as $reply) {
  165. $this->assertTrue($reply['comment'] instanceof IComment);
  166. $this->assertSame($reply['comment']->getId(), strval($id));
  167. $this->assertSame(count($reply['replies']), 0);
  168. $id--;
  169. }
  170. }
  171. public function testGetTreeNoReplies(): void {
  172. $id = $this->addDatabaseEntry(0, 0);
  173. $manager = $this->getManager();
  174. $tree = $manager->getTree($id);
  175. // Verifying the root comment
  176. $this->assertTrue(isset($tree['comment']));
  177. $this->assertTrue($tree['comment'] instanceof IComment);
  178. $this->assertSame($tree['comment']->getId(), strval($id));
  179. $this->assertTrue(isset($tree['replies']));
  180. $this->assertSame(count($tree['replies']), 0);
  181. // one level deep
  182. foreach ($tree['replies'] as $reply) {
  183. throw new \Exception('This ain`t happen');
  184. }
  185. }
  186. public function testGetTreeWithLimitAndOffset(): void {
  187. $headId = $this->addDatabaseEntry(0, 0);
  188. $this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
  189. $this->addDatabaseEntry($headId, $headId, new \DateTime('-2 hours'));
  190. $this->addDatabaseEntry($headId, $headId, new \DateTime('-1 hour'));
  191. $idToVerify = $this->addDatabaseEntry($headId, $headId, new \DateTime());
  192. $manager = $this->getManager();
  193. for ($offset = 0; $offset < 3; $offset += 2) {
  194. $tree = $manager->getTree(strval($headId), 2, $offset);
  195. // Verifying the root comment
  196. $this->assertTrue(isset($tree['comment']));
  197. $this->assertTrue($tree['comment'] instanceof IComment);
  198. $this->assertSame($tree['comment']->getId(), strval($headId));
  199. $this->assertTrue(isset($tree['replies']));
  200. $this->assertSame(count($tree['replies']), 2);
  201. // one level deep
  202. foreach ($tree['replies'] as $reply) {
  203. $this->assertTrue($reply['comment'] instanceof IComment);
  204. $this->assertSame($reply['comment']->getId(), strval($idToVerify));
  205. $this->assertSame(count($reply['replies']), 0);
  206. $idToVerify--;
  207. }
  208. }
  209. }
  210. public function testGetForObject(): void {
  211. $this->addDatabaseEntry(0, 0);
  212. $manager = $this->getManager();
  213. $comments = $manager->getForObject('files', 'file64');
  214. $this->assertTrue(is_array($comments));
  215. $this->assertSame(count($comments), 1);
  216. $this->assertTrue($comments[0] instanceof IComment);
  217. $this->assertSame($comments[0]->getMessage(), 'nice one');
  218. }
  219. public function testGetForObjectWithLimitAndOffset(): void {
  220. $this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
  221. $this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
  222. $this->addDatabaseEntry(1, 1, new \DateTime('-4 hours'));
  223. $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
  224. $this->addDatabaseEntry(2, 2, new \DateTime('-2 hours'));
  225. $this->addDatabaseEntry(2, 2, new \DateTime('-1 hours'));
  226. $idToVerify = $this->addDatabaseEntry(3, 1, new \DateTime());
  227. $manager = $this->getManager();
  228. $offset = 0;
  229. do {
  230. $comments = $manager->getForObject('files', 'file64', 3, $offset);
  231. $this->assertTrue(is_array($comments));
  232. foreach ($comments as $comment) {
  233. $this->assertTrue($comment instanceof IComment);
  234. $this->assertSame($comment->getMessage(), 'nice one');
  235. $this->assertSame($comment->getId(), strval($idToVerify));
  236. $idToVerify--;
  237. }
  238. $offset += 3;
  239. } while (count($comments) > 0);
  240. }
  241. public function testGetForObjectWithDateTimeConstraint(): void {
  242. $this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
  243. $this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
  244. $id1 = $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
  245. $id2 = $this->addDatabaseEntry(2, 2, new \DateTime('-2 hours'));
  246. $manager = $this->getManager();
  247. $comments = $manager->getForObject('files', 'file64', 0, 0, new \DateTime('-4 hours'));
  248. $this->assertSame(count($comments), 2);
  249. $this->assertSame($comments[0]->getId(), strval($id2));
  250. $this->assertSame($comments[1]->getId(), strval($id1));
  251. }
  252. public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint(): void {
  253. $this->addDatabaseEntry(0, 0, new \DateTime('-7 hours'));
  254. $this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
  255. $this->addDatabaseEntry(1, 1, new \DateTime('-5 hours'));
  256. $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
  257. $this->addDatabaseEntry(2, 2, new \DateTime('-2 hours'));
  258. $this->addDatabaseEntry(2, 2, new \DateTime('-1 hours'));
  259. $idToVerify = $this->addDatabaseEntry(3, 1, new \DateTime());
  260. $manager = $this->getManager();
  261. $offset = 0;
  262. do {
  263. $comments = $manager->getForObject('files', 'file64', 3, $offset, new \DateTime('-4 hours'));
  264. $this->assertTrue(is_array($comments));
  265. foreach ($comments as $comment) {
  266. $this->assertTrue($comment instanceof IComment);
  267. $this->assertSame($comment->getMessage(), 'nice one');
  268. $this->assertSame($comment->getId(), strval($idToVerify));
  269. $this->assertTrue(intval($comment->getId()) >= 4);
  270. $idToVerify--;
  271. }
  272. $offset += 3;
  273. } while (count($comments) > 0);
  274. }
  275. public function testGetNumberOfCommentsForObject(): void {
  276. for ($i = 1; $i < 5; $i++) {
  277. $this->addDatabaseEntry(0, 0);
  278. }
  279. $manager = $this->getManager();
  280. $amount = $manager->getNumberOfCommentsForObject('untype', '00');
  281. $this->assertSame($amount, 0);
  282. $amount = $manager->getNumberOfCommentsForObject('files', 'file64');
  283. $this->assertSame($amount, 4);
  284. }
  285. public function testGetNumberOfUnreadCommentsForFolder(): void {
  286. $folder = $this->createMock(Folder::class);
  287. $fileIds = range(1111, 1114);
  288. $children = array_map(function (int $id) {
  289. $file = $this->createMock(Folder::class);
  290. $file->method('getId')
  291. ->willReturn($id);
  292. return $file;
  293. }, $fileIds);
  294. $folder->method('getId')->willReturn(1000);
  295. $folder->method('getDirectoryListing')->willReturn($children);
  296. $this->rootFolder->method('getFirstNodeById')
  297. ->with($folder->getId())
  298. ->willReturn($folder);
  299. // 2 comment for 1111 with 1 before read marker
  300. // 2 comments for 1112 with no read marker
  301. // 1 comment for 1113 before read marker
  302. // 1 comment for 1114 with no read marker
  303. $this->addDatabaseEntry(0, 0, null, null, $fileIds[1]);
  304. for ($i = 0; $i < 4; $i++) {
  305. $this->addDatabaseEntry(0, 0, null, null, $fileIds[$i]);
  306. }
  307. $this->addDatabaseEntry(0, 0, (new \DateTime())->modify('-2 days'), null, $fileIds[0]);
  308. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  309. $user = $this->createMock(IUser::class);
  310. $user->expects($this->any())
  311. ->method('getUID')
  312. ->willReturn('comment_test');
  313. $manager = $this->getManager();
  314. $manager->setReadMark('files', (string)$fileIds[0], (new \DateTime())->modify('-1 days'), $user);
  315. $manager->setReadMark('files', (string)$fileIds[2], (new \DateTime()), $user);
  316. $amount = $manager->getNumberOfUnreadCommentsForFolder($folder->getId(), $user);
  317. $this->assertEquals([
  318. $fileIds[0] => 1,
  319. $fileIds[1] => 2,
  320. $fileIds[3] => 1,
  321. ], $amount);
  322. }
  323. /**
  324. * @dataProvider dataGetForObjectSince
  325. * @param $lastKnown
  326. * @param $order
  327. * @param $limit
  328. * @param $resultFrom
  329. * @param $resultTo
  330. */
  331. public function testGetForObjectSince($lastKnown, $order, $limit, $resultFrom, $resultTo): void {
  332. $ids = [];
  333. $ids[] = $this->addDatabaseEntry(0, 0);
  334. $ids[] = $this->addDatabaseEntry(0, 0);
  335. $ids[] = $this->addDatabaseEntry(0, 0);
  336. $ids[] = $this->addDatabaseEntry(0, 0);
  337. $ids[] = $this->addDatabaseEntry(0, 0);
  338. $manager = $this->getManager();
  339. $comments = $manager->getForObjectSince('files', 'file64', ($lastKnown === null ? 0 : $ids[$lastKnown]), $order, $limit);
  340. $expected = array_slice($ids, $resultFrom, $resultTo - $resultFrom + 1);
  341. if ($order === 'desc') {
  342. $expected = array_reverse($expected);
  343. }
  344. $this->assertSame($expected, array_map(function (IComment $c) {
  345. return (int)$c->getId();
  346. }, $comments));
  347. }
  348. public function dataGetForObjectSince() {
  349. return [
  350. [null, 'asc', 20, 0, 4],
  351. [null, 'asc', 2, 0, 1],
  352. [null, 'desc', 20, 0, 4],
  353. [null, 'desc', 2, 3, 4],
  354. [1, 'asc', 20, 2, 4],
  355. [1, 'asc', 2, 2, 3],
  356. [3, 'desc', 20, 0, 2],
  357. [3, 'desc', 2, 1, 2],
  358. ];
  359. }
  360. public function invalidCreateArgsProvider() {
  361. return [
  362. ['', 'aId-1', 'oType-1', 'oId-1'],
  363. ['aType-1', '', 'oType-1', 'oId-1'],
  364. ['aType-1', 'aId-1', '', 'oId-1'],
  365. ['aType-1', 'aId-1', 'oType-1', ''],
  366. [1, 'aId-1', 'oType-1', 'oId-1'],
  367. ['aType-1', 1, 'oType-1', 'oId-1'],
  368. ['aType-1', 'aId-1', 1, 'oId-1'],
  369. ['aType-1', 'aId-1', 'oType-1', 1],
  370. ];
  371. }
  372. /**
  373. * @dataProvider invalidCreateArgsProvider
  374. * @param string $aType
  375. * @param string $aId
  376. * @param string $oType
  377. * @param string $oId
  378. */
  379. public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId): void {
  380. $this->expectException(\InvalidArgumentException::class);
  381. $manager = $this->getManager();
  382. $manager->create($aType, $aId, $oType, $oId);
  383. }
  384. public function testCreateComment(): void {
  385. $actorType = 'bot';
  386. $actorId = 'bob';
  387. $objectType = 'weather';
  388. $objectId = 'bielefeld';
  389. $comment = $this->getManager()->create($actorType, $actorId, $objectType, $objectId);
  390. $this->assertTrue($comment instanceof IComment);
  391. $this->assertSame($comment->getActorType(), $actorType);
  392. $this->assertSame($comment->getActorId(), $actorId);
  393. $this->assertSame($comment->getObjectType(), $objectType);
  394. $this->assertSame($comment->getObjectId(), $objectId);
  395. }
  396. public function testDelete(): void {
  397. $this->expectException(\OCP\Comments\NotFoundException::class);
  398. $manager = $this->getManager();
  399. $done = $manager->delete('404');
  400. $this->assertFalse($done);
  401. $done = $manager->delete('%');
  402. $this->assertFalse($done);
  403. $done = $manager->delete('');
  404. $this->assertFalse($done);
  405. $id = strval($this->addDatabaseEntry(0, 0));
  406. $comment = $manager->get($id);
  407. $this->assertTrue($comment instanceof IComment);
  408. $done = $manager->delete($id);
  409. $this->assertTrue($done);
  410. $manager->get($id);
  411. }
  412. /**
  413. * @dataProvider providerTestSave
  414. */
  415. public function testSave(string $message, string $actorId, string $verb, ?string $parentId, ?string $id = ''): IComment {
  416. $manager = $this->getManager();
  417. $comment = new Comment();
  418. $comment
  419. ->setId($id)
  420. ->setActor('users', $actorId)
  421. ->setObject('files', 'file64')
  422. ->setMessage($message)
  423. ->setVerb($verb);
  424. if ($parentId) {
  425. $comment->setParentId($parentId);
  426. }
  427. $saveSuccessful = $manager->save($comment);
  428. $this->assertTrue($saveSuccessful);
  429. $this->assertTrue($comment->getId() !== '');
  430. $this->assertTrue($comment->getId() !== '0');
  431. $this->assertTrue(!is_null($comment->getCreationDateTime()));
  432. $loadedComment = $manager->get($comment->getId());
  433. $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
  434. $this->assertEquals($comment->getCreationDateTime()->getTimestamp(), $loadedComment->getCreationDateTime()->getTimestamp());
  435. return $comment;
  436. }
  437. public function providerTestSave(): array {
  438. return [
  439. ['very beautiful, I am impressed!', 'alice', 'comment', null]
  440. ];
  441. }
  442. public function testSaveUpdate(): void {
  443. $manager = $this->getManager();
  444. $comment = new Comment();
  445. $comment
  446. ->setActor('users', 'alice')
  447. ->setObject('files', 'file64')
  448. ->setMessage('very beautiful, I am impressed!')
  449. ->setVerb('comment')
  450. ->setExpireDate(new \DateTime('+2 hours'));
  451. $manager->save($comment);
  452. $loadedComment = $manager->get($comment->getId());
  453. // Compare current object with database values
  454. $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
  455. $this->assertSame(
  456. $comment->getExpireDate()->format('Y-m-d H:i:s'),
  457. $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
  458. );
  459. // Preserve the original comment to compare after update
  460. $original = clone $comment;
  461. // Update values
  462. $comment->setMessage('very beautiful, I am really so much impressed!')
  463. ->setExpireDate(new \DateTime('+1 hours'));
  464. $manager->save($comment);
  465. $loadedComment = $manager->get($comment->getId());
  466. // Compare current object with database values
  467. $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
  468. $this->assertSame(
  469. $comment->getExpireDate()->format('Y-m-d H:i:s'),
  470. $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
  471. );
  472. // Compare original object with database values
  473. $this->assertNotSame($original->getMessage(), $loadedComment->getMessage());
  474. $this->assertNotSame(
  475. $original->getExpireDate()->format('Y-m-d H:i:s'),
  476. $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
  477. );
  478. }
  479. public function testSaveUpdateException(): void {
  480. $this->expectException(\OCP\Comments\NotFoundException::class);
  481. $manager = $this->getManager();
  482. $comment = new Comment();
  483. $comment
  484. ->setActor('users', 'alice')
  485. ->setObject('files', 'file64')
  486. ->setMessage('very beautiful, I am impressed!')
  487. ->setVerb('comment');
  488. $manager->save($comment);
  489. $manager->delete($comment->getId());
  490. $comment->setMessage('very beautiful, I am really so much impressed!');
  491. $manager->save($comment);
  492. }
  493. public function testSaveIncomplete(): void {
  494. $this->expectException(\UnexpectedValueException::class);
  495. $manager = $this->getManager();
  496. $comment = new Comment();
  497. $comment->setMessage('from no one to nothing');
  498. $manager->save($comment);
  499. }
  500. public function testSaveAsChild(): void {
  501. $id = $this->addDatabaseEntry(0, 0);
  502. $manager = $this->getManager();
  503. for ($i = 0; $i < 3; $i++) {
  504. $comment = new Comment();
  505. $comment
  506. ->setActor('users', 'alice')
  507. ->setObject('files', 'file64')
  508. ->setParentId(strval($id))
  509. ->setMessage('full ack')
  510. ->setVerb('comment')
  511. // setting the creation time avoids using sleep() while making sure to test with different timestamps
  512. ->setCreationDateTime(new \DateTime('+' . $i . ' minutes'));
  513. $manager->save($comment);
  514. $this->assertSame($comment->getTopmostParentId(), strval($id));
  515. $parentComment = $manager->get(strval($id));
  516. $this->assertSame($parentComment->getChildrenCount(), $i + 1);
  517. $this->assertEquals($parentComment->getLatestChildDateTime()->getTimestamp(), $comment->getCreationDateTime()->getTimestamp());
  518. }
  519. }
  520. public function invalidActorArgsProvider() {
  521. return
  522. [
  523. ['', ''],
  524. [1, 'alice'],
  525. ['users', 1],
  526. ];
  527. }
  528. /**
  529. * @dataProvider invalidActorArgsProvider
  530. * @param string $type
  531. * @param string $id
  532. */
  533. public function testDeleteReferencesOfActorInvalidInput($type, $id): void {
  534. $this->expectException(\InvalidArgumentException::class);
  535. $manager = $this->getManager();
  536. $manager->deleteReferencesOfActor($type, $id);
  537. }
  538. public function testDeleteReferencesOfActor(): void {
  539. $ids = [];
  540. $ids[] = $this->addDatabaseEntry(0, 0);
  541. $ids[] = $this->addDatabaseEntry(0, 0);
  542. $ids[] = $this->addDatabaseEntry(0, 0);
  543. $manager = $this->getManager();
  544. // just to make sure they are really set, with correct actor data
  545. $comment = $manager->get(strval($ids[1]));
  546. $this->assertSame($comment->getActorType(), 'users');
  547. $this->assertSame($comment->getActorId(), 'alice');
  548. $wasSuccessful = $manager->deleteReferencesOfActor('users', 'alice');
  549. $this->assertTrue($wasSuccessful);
  550. foreach ($ids as $id) {
  551. $comment = $manager->get(strval($id));
  552. $this->assertSame($comment->getActorType(), ICommentsManager::DELETED_USER);
  553. $this->assertSame($comment->getActorId(), ICommentsManager::DELETED_USER);
  554. }
  555. // actor info is gone from DB, but when database interaction is alright,
  556. // we still expect to get true back
  557. $wasSuccessful = $manager->deleteReferencesOfActor('users', 'alice');
  558. $this->assertTrue($wasSuccessful);
  559. }
  560. public function testDeleteReferencesOfActorWithUserManagement(): void {
  561. $user = \OC::$server->getUserManager()->createUser('xenia', 'NotAnEasyPassword123456+');
  562. $this->assertTrue($user instanceof IUser);
  563. $manager = \OC::$server->get(ICommentsManager::class);
  564. $comment = $manager->create('users', $user->getUID(), 'files', 'file64');
  565. $comment
  566. ->setMessage('Most important comment I ever left on the Internet.')
  567. ->setVerb('comment');
  568. $status = $manager->save($comment);
  569. $this->assertTrue($status);
  570. $commentID = $comment->getId();
  571. $user->delete();
  572. $comment = $manager->get($commentID);
  573. $this->assertSame($comment->getActorType(), ICommentsManager::DELETED_USER);
  574. $this->assertSame($comment->getActorId(), ICommentsManager::DELETED_USER);
  575. }
  576. public function invalidObjectArgsProvider() {
  577. return
  578. [
  579. ['', ''],
  580. [1, 'file64'],
  581. ['files', 1],
  582. ];
  583. }
  584. /**
  585. * @dataProvider invalidObjectArgsProvider
  586. * @param string $type
  587. * @param string $id
  588. */
  589. public function testDeleteCommentsAtObjectInvalidInput($type, $id): void {
  590. $this->expectException(\InvalidArgumentException::class);
  591. $manager = $this->getManager();
  592. $manager->deleteCommentsAtObject($type, $id);
  593. }
  594. public function testDeleteCommentsAtObject(): void {
  595. $ids = [];
  596. $ids[] = $this->addDatabaseEntry(0, 0);
  597. $ids[] = $this->addDatabaseEntry(0, 0);
  598. $ids[] = $this->addDatabaseEntry(0, 0);
  599. $manager = $this->getManager();
  600. // just to make sure they are really set, with correct actor data
  601. $comment = $manager->get(strval($ids[1]));
  602. $this->assertSame($comment->getObjectType(), 'files');
  603. $this->assertSame($comment->getObjectId(), 'file64');
  604. $wasSuccessful = $manager->deleteCommentsAtObject('files', 'file64');
  605. $this->assertTrue($wasSuccessful);
  606. $verified = 0;
  607. foreach ($ids as $id) {
  608. try {
  609. $manager->get(strval($id));
  610. } catch (NotFoundException $e) {
  611. $verified++;
  612. }
  613. }
  614. $this->assertSame($verified, 3);
  615. // actor info is gone from DB, but when database interaction is alright,
  616. // we still expect to get true back
  617. $wasSuccessful = $manager->deleteCommentsAtObject('files', 'file64');
  618. $this->assertTrue($wasSuccessful);
  619. }
  620. public function testDeleteCommentsExpiredAtObjectTypeAndId(): void {
  621. $ids = [];
  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. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('-2 hours'));
  627. $ids[] = $this->addDatabaseEntry(0, 0, null, null, null, new \DateTime('-2 hours'));
  628. $manager = new Manager(
  629. $this->connection,
  630. $this->createMock(LoggerInterface::class),
  631. $this->createMock(IConfig::class),
  632. Server::get(ITimeFactory::class),
  633. new EmojiHelper($this->connection),
  634. $this->createMock(IInitialStateService::class),
  635. $this->rootFolder,
  636. $this->createMock(IEventDispatcher::class)
  637. );
  638. // just to make sure they are really set, with correct actor data
  639. $comment = $manager->get((string)$ids[1]);
  640. $this->assertSame($comment->getObjectType(), 'files');
  641. $this->assertSame($comment->getObjectId(), 'file64');
  642. $deleted = $manager->deleteCommentsExpiredAtObject('files', 'file64');
  643. $this->assertTrue($deleted);
  644. $deleted = 0;
  645. $exists = 0;
  646. foreach ($ids as $id) {
  647. try {
  648. $manager->get((string)$id);
  649. $exists++;
  650. } catch (NotFoundException $e) {
  651. $deleted++;
  652. }
  653. }
  654. $this->assertSame($exists, 3);
  655. $this->assertSame($deleted, 3);
  656. // actor info is gone from DB, but when database interaction is alright,
  657. // we still expect to get true back
  658. $deleted = $manager->deleteCommentsExpiredAtObject('files', 'file64');
  659. $this->assertFalse($deleted);
  660. }
  661. public function testDeleteCommentsExpiredAtObjectType(): void {
  662. $ids = [];
  663. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file1', new \DateTime('-2 hours'));
  664. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file2', new \DateTime('-2 hours'));
  665. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime('-2 hours'));
  666. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime());
  667. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime());
  668. $ids[] = $this->addDatabaseEntry(0, 0, null, null, 'file3', new \DateTime());
  669. $manager = new Manager(
  670. $this->connection,
  671. $this->createMock(LoggerInterface::class),
  672. $this->createMock(IConfig::class),
  673. Server::get(ITimeFactory::class),
  674. new EmojiHelper($this->connection),
  675. $this->createMock(IInitialStateService::class),
  676. $this->rootFolder,
  677. $this->createMock(IEventDispatcher::class)
  678. );
  679. $deleted = $manager->deleteCommentsExpiredAtObject('files');
  680. $this->assertTrue($deleted);
  681. $deleted = 0;
  682. $exists = 0;
  683. foreach ($ids as $id) {
  684. try {
  685. $manager->get((string)$id);
  686. $exists++;
  687. } catch (NotFoundException $e) {
  688. $deleted++;
  689. }
  690. }
  691. $this->assertSame($exists, 0);
  692. $this->assertSame($deleted, 6);
  693. // actor info is gone from DB, but when database interaction is alright,
  694. // we still expect to get true back
  695. $deleted = $manager->deleteCommentsExpiredAtObject('files');
  696. $this->assertFalse($deleted);
  697. }
  698. public function testSetMarkRead(): void {
  699. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  700. $user = $this->createMock(IUser::class);
  701. $user->expects($this->any())
  702. ->method('getUID')
  703. ->willReturn('alice');
  704. $dateTimeSet = new \DateTime();
  705. $manager = $this->getManager();
  706. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  707. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  708. $this->assertEquals($dateTimeGet->getTimestamp(), $dateTimeSet->getTimestamp());
  709. }
  710. public function testSetMarkReadUpdate(): void {
  711. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  712. $user = $this->createMock(IUser::class);
  713. $user->expects($this->any())
  714. ->method('getUID')
  715. ->willReturn('alice');
  716. $dateTimeSet = new \DateTime('yesterday');
  717. $manager = $this->getManager();
  718. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  719. $dateTimeSet = new \DateTime('today');
  720. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  721. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  722. $this->assertEquals($dateTimeGet, $dateTimeSet);
  723. }
  724. public function testReadMarkDeleteUser(): void {
  725. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  726. $user = $this->createMock(IUser::class);
  727. $user->expects($this->any())
  728. ->method('getUID')
  729. ->willReturn('alice');
  730. $dateTimeSet = new \DateTime();
  731. $manager = $this->getManager();
  732. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  733. $manager->deleteReadMarksFromUser($user);
  734. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  735. $this->assertNull($dateTimeGet);
  736. }
  737. public function testReadMarkDeleteObject(): void {
  738. /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
  739. $user = $this->createMock(IUser::class);
  740. $user->expects($this->any())
  741. ->method('getUID')
  742. ->willReturn('alice');
  743. $dateTimeSet = new \DateTime();
  744. $manager = $this->getManager();
  745. $manager->setReadMark('robot', '36', $dateTimeSet, $user);
  746. $manager->deleteReadMarksOnObject('robot', '36');
  747. $dateTimeGet = $manager->getReadMark('robot', '36', $user);
  748. $this->assertNull($dateTimeGet);
  749. }
  750. public function testSendEvent(): void {
  751. $handler1 = $this->getMockBuilder(ICommentsEventHandler::class)->getMock();
  752. $handler1->expects($this->exactly(4))
  753. ->method('handle');
  754. $handler2 = $this->getMockBuilder(ICommentsEventHandler::class)->getMock();
  755. $handler1->expects($this->exactly(4))
  756. ->method('handle');
  757. $manager = $this->getManager();
  758. $manager->registerEventHandler(function () use ($handler1) {
  759. return $handler1;
  760. });
  761. $manager->registerEventHandler(function () use ($handler2) {
  762. return $handler2;
  763. });
  764. $comment = new Comment();
  765. $comment
  766. ->setActor('users', 'alice')
  767. ->setObject('files', 'file64')
  768. ->setMessage('very beautiful, I am impressed!')
  769. ->setVerb('comment');
  770. // Add event
  771. $manager->save($comment);
  772. // Update event
  773. $comment->setMessage('Different topic');
  774. $manager->save($comment);
  775. // Delete event
  776. $manager->delete($comment->getId());
  777. }
  778. public function testResolveDisplayName(): void {
  779. $manager = $this->getManager();
  780. $planetClosure = function ($name) {
  781. return ucfirst($name);
  782. };
  783. $galaxyClosure = function ($name) {
  784. return strtoupper($name);
  785. };
  786. $manager->registerDisplayNameResolver('planet', $planetClosure);
  787. $manager->registerDisplayNameResolver('galaxy', $galaxyClosure);
  788. $this->assertSame('Neptune', $manager->resolveDisplayName('planet', 'neptune'));
  789. $this->assertSame('SOMBRERO', $manager->resolveDisplayName('galaxy', 'sombrero'));
  790. }
  791. public function testRegisterResolverDuplicate(): void {
  792. $this->expectException(\OutOfBoundsException::class);
  793. $manager = $this->getManager();
  794. $planetClosure = function ($name) {
  795. return ucfirst($name);
  796. };
  797. $manager->registerDisplayNameResolver('planet', $planetClosure);
  798. $manager->registerDisplayNameResolver('planet', $planetClosure);
  799. }
  800. public function testRegisterResolverInvalidType(): void {
  801. $this->expectException(\InvalidArgumentException::class);
  802. $manager = $this->getManager();
  803. $planetClosure = function ($name) {
  804. return ucfirst($name);
  805. };
  806. $manager->registerDisplayNameResolver(1337, $planetClosure);
  807. }
  808. public function testResolveDisplayNameUnregisteredType(): void {
  809. $this->expectException(\OutOfBoundsException::class);
  810. $manager = $this->getManager();
  811. $planetClosure = function ($name) {
  812. return ucfirst($name);
  813. };
  814. $manager->registerDisplayNameResolver('planet', $planetClosure);
  815. $manager->resolveDisplayName('galaxy', 'sombrero');
  816. }
  817. public function testResolveDisplayNameDirtyResolver(): void {
  818. $manager = $this->getManager();
  819. $planetClosure = function () {
  820. return null;
  821. };
  822. $manager->registerDisplayNameResolver('planet', $planetClosure);
  823. $this->assertTrue(is_string($manager->resolveDisplayName('planet', 'neptune')));
  824. }
  825. private function skipIfNotSupport4ByteUTF() {
  826. if (!$this->getManager()->supportReactions()) {
  827. $this->markTestSkipped('MySQL doesn\'t support 4 byte UTF-8');
  828. }
  829. }
  830. /**
  831. * @dataProvider providerTestReactionAddAndDelete
  832. *
  833. * @param IComment[] $comments
  834. * @param array $reactionsExpected
  835. * @return void
  836. */
  837. public function testReactionAddAndDelete(array $comments, array $reactionsExpected): void {
  838. $this->skipIfNotSupport4ByteUTF();
  839. $manager = $this->getManager();
  840. $processedComments = $this->proccessComments($comments);
  841. $comment = end($processedComments);
  842. if ($comment->getParentId()) {
  843. $parent = $manager->get($comment->getParentId());
  844. $this->assertEqualsCanonicalizing($reactionsExpected, $parent->getReactions());
  845. }
  846. }
  847. public function providerTestReactionAddAndDelete(): array {
  848. return[
  849. [
  850. [
  851. ['message', 'alice', 'comment', null],
  852. ], [],
  853. ],
  854. [
  855. [
  856. ['message', 'alice', 'comment', null],
  857. ['👍', 'alice', 'reaction', 'message#alice'],
  858. ], ['👍' => 1],
  859. ],
  860. [
  861. [
  862. ['message', 'alice', 'comment', null],
  863. ['👍', 'alice', 'reaction', 'message#alice'],
  864. ['👍', 'alice', 'reaction', 'message#alice'],
  865. ], ['👍' => 1],
  866. ],
  867. [
  868. [
  869. ['message', 'alice', 'comment', null],
  870. ['👍', 'alice', 'reaction', 'message#alice'],
  871. ['👍', 'frank', 'reaction', 'message#alice'],
  872. ], ['👍' => 2],
  873. ],
  874. [
  875. [
  876. ['message', 'alice', 'comment', null],
  877. ['👍', 'alice', 'reaction', 'message#alice'],
  878. ['👍', 'frank', 'reaction', 'message#alice'],
  879. ['👍', 'frank', 'reaction_deleted', 'message#alice'],
  880. ], ['👍' => 1],
  881. ],
  882. [
  883. [
  884. ['message', 'alice', 'comment', null],
  885. ['👍', 'alice', 'reaction', 'message#alice'],
  886. ['👍', 'frank', 'reaction', 'message#alice'],
  887. ['👍', 'alice', 'reaction_deleted', 'message#alice'],
  888. ['👍', 'frank', 'reaction_deleted', 'message#alice'],
  889. ], [],
  890. ],
  891. ];
  892. }
  893. public function testResolveDisplayNameInvalidType(): void {
  894. $this->expectException(\InvalidArgumentException::class);
  895. $manager = $this->getManager();
  896. $planetClosure = function () {
  897. return null;
  898. };
  899. $manager->registerDisplayNameResolver('planet', $planetClosure);
  900. $this->assertTrue(is_string($manager->resolveDisplayName(1337, 'neptune')));
  901. }
  902. /**
  903. * @param array $data
  904. * @return IComment[]
  905. */
  906. private function proccessComments(array $data): array {
  907. /** @var IComment[] */
  908. $comments = [];
  909. foreach ($data as $comment) {
  910. [$message, $actorId, $verb, $parentText] = $comment;
  911. $parentId = null;
  912. if ($parentText) {
  913. $parentId = (string)$comments[$parentText]->getId();
  914. }
  915. $id = '';
  916. if ($verb === 'reaction_deleted') {
  917. $id = $comments[$message . '#' . $actorId]->getId();
  918. }
  919. $comment = $this->testSave($message, $actorId, $verb, $parentId, $id);
  920. $comments[$comment->getMessage() . '#' . $comment->getActorId()] = $comment;
  921. }
  922. return $comments;
  923. }
  924. /**
  925. * @dataProvider providerTestRetrieveAllReactions
  926. */
  927. public function testRetrieveAllReactions(array $comments, array $expected): void {
  928. $this->skipIfNotSupport4ByteUTF();
  929. $manager = $this->getManager();
  930. $processedComments = $this->proccessComments($comments);
  931. $comment = reset($processedComments);
  932. $all = $manager->retrieveAllReactions($comment->getId());
  933. $actual = array_map(function ($row) {
  934. return [
  935. 'message' => $row->getMessage(),
  936. 'actorId' => $row->getActorId(),
  937. ];
  938. }, $all);
  939. $this->assertEqualsCanonicalizing($expected, $actual);
  940. }
  941. public function providerTestRetrieveAllReactions(): array {
  942. return [
  943. [
  944. [
  945. ['message', 'alice', 'comment', null],
  946. ],
  947. [],
  948. ],
  949. [
  950. [
  951. ['message', 'alice', 'comment', null],
  952. ['👍', 'alice', 'reaction', 'message#alice'],
  953. ['👍', 'frank', 'reaction', 'message#alice'],
  954. ],
  955. [
  956. ['👍', 'alice'],
  957. ['👍', 'frank'],
  958. ],
  959. ],
  960. [
  961. [
  962. ['message', 'alice', 'comment', null],
  963. ['👍', 'alice', 'reaction', 'message#alice'],
  964. ['👍', 'alice', 'reaction', 'message#alice'],
  965. ['👍', 'frank', 'reaction', 'message#alice'],
  966. ],
  967. [
  968. ['👍', 'alice'],
  969. ['👍', 'frank'],
  970. ],
  971. ],
  972. [# 600 reactions to cover chunk size when retrieve comments of reactions.
  973. [
  974. ['message', 'alice', 'comment', null],
  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. ['🕺🏽', 'alice', 'reaction', 'message#alice'],
  1572. ['🕴🏽', 'alice', 'reaction', 'message#alice'],
  1573. ['👩🏽‍🦽', 'alice', 'reaction', 'message#alice'],
  1574. ['🧑🏽‍🦽', 'alice', 'reaction', 'message#alice'],
  1575. ],
  1576. [
  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. ['🕺🏽', 'alice'],
  2174. ['🕴🏽', 'alice'],
  2175. ['👩🏽‍🦽', 'alice'],
  2176. ['🧑🏽‍🦽', 'alice'],
  2177. ],
  2178. ],
  2179. ];
  2180. }
  2181. /**
  2182. * @dataProvider providerTestRetrieveAllReactionsWithSpecificReaction
  2183. */
  2184. public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected): void {
  2185. $this->skipIfNotSupport4ByteUTF();
  2186. $manager = $this->getManager();
  2187. $processedComments = $this->proccessComments($comments);
  2188. $comment = reset($processedComments);
  2189. $all = $manager->retrieveAllReactionsWithSpecificReaction($comment->getId(), $reaction);
  2190. $actual = array_map(function ($row) {
  2191. return [
  2192. 'message' => $row->getMessage(),
  2193. 'actorId' => $row->getActorId(),
  2194. ];
  2195. }, $all);
  2196. $this->assertEqualsCanonicalizing($expected, $actual);
  2197. }
  2198. public function providerTestRetrieveAllReactionsWithSpecificReaction(): array {
  2199. return [
  2200. [
  2201. [
  2202. ['message', 'alice', 'comment', null],
  2203. ],
  2204. '👎',
  2205. [],
  2206. ],
  2207. [
  2208. [
  2209. ['message', 'alice', 'comment', null],
  2210. ['👍', 'alice', 'reaction', 'message#alice'],
  2211. ['👍', 'frank', 'reaction', 'message#alice'],
  2212. ],
  2213. '👍',
  2214. [
  2215. ['👍', 'alice'],
  2216. ['👍', 'frank'],
  2217. ],
  2218. ],
  2219. [
  2220. [
  2221. ['message', 'alice', 'comment', null],
  2222. ['👍', 'alice', 'reaction', 'message#alice'],
  2223. ['👎', 'alice', 'reaction', 'message#alice'],
  2224. ['👍', 'frank', 'reaction', 'message#alice'],
  2225. ],
  2226. '👎',
  2227. [
  2228. ['👎', 'alice'],
  2229. ],
  2230. ],
  2231. ];
  2232. }
  2233. /**
  2234. * @dataProvider providerTestGetReactionComment
  2235. */
  2236. public function testGetReactionComment(array $comments, array $expected, bool $notFound): void {
  2237. $this->skipIfNotSupport4ByteUTF();
  2238. $manager = $this->getManager();
  2239. $processedComments = $this->proccessComments($comments);
  2240. $keys = ['message', 'actorId', 'verb', 'parent'];
  2241. $expected = array_combine($keys, $expected);
  2242. if ($notFound) {
  2243. $this->expectException(\OCP\Comments\NotFoundException::class);
  2244. }
  2245. $comment = $processedComments[$expected['message'] . '#' . $expected['actorId']];
  2246. $actual = $manager->getReactionComment($comment->getParentId(), $comment->getActorType(), $comment->getActorId(), $comment->getMessage());
  2247. if (!$notFound) {
  2248. $this->assertEquals($expected['message'], $actual->getMessage());
  2249. $this->assertEquals($expected['actorId'], $actual->getActorId());
  2250. $this->assertEquals($expected['verb'], $actual->getVerb());
  2251. $this->assertEquals($processedComments[$expected['parent']]->getId(), $actual->getParentId());
  2252. }
  2253. }
  2254. public function providerTestGetReactionComment(): array {
  2255. return [
  2256. [
  2257. [
  2258. ['message', 'Matthew', 'comment', null],
  2259. ['👍', 'Matthew', 'reaction', 'message#Matthew'],
  2260. ['👍', 'Mark', 'reaction', 'message#Matthew'],
  2261. ['👍', 'Luke', 'reaction', 'message#Matthew'],
  2262. ['👍', 'John', 'reaction', 'message#Matthew'],
  2263. ],
  2264. ['👍', 'Matthew', 'reaction', 'message#Matthew'],
  2265. false,
  2266. ],
  2267. [
  2268. [
  2269. ['message', 'Matthew', 'comment', null],
  2270. ['👍', 'Matthew', 'reaction', 'message#Matthew'],
  2271. ['👍', 'Mark', 'reaction', 'message#Matthew'],
  2272. ['👍', 'Luke', 'reaction', 'message#Matthew'],
  2273. ['👍', 'John', 'reaction', 'message#Matthew'],
  2274. ],
  2275. ['👍', 'Mark', 'reaction', 'message#Matthew'],
  2276. false,
  2277. ],
  2278. [
  2279. [
  2280. ['message', 'Matthew', 'comment', null],
  2281. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2282. ],
  2283. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2284. false,
  2285. ],
  2286. [
  2287. [
  2288. ['message', 'Matthew', 'comment', null],
  2289. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2290. ['👎', 'Matthew', 'reaction_deleted', 'message#Matthew'],
  2291. ],
  2292. ['👎', 'Matthew', 'reaction', 'message#Matthew'],
  2293. true,
  2294. ],
  2295. ];
  2296. }
  2297. /**
  2298. * @dataProvider providerTestReactionMessageSize
  2299. */
  2300. public function testReactionMessageSize($reactionString, $valid): void {
  2301. $this->skipIfNotSupport4ByteUTF();
  2302. if (!$valid) {
  2303. $this->expectException(\UnexpectedValueException::class);
  2304. }
  2305. $manager = $this->getManager();
  2306. $comment = new Comment();
  2307. $comment->setMessage($reactionString)
  2308. ->setVerb('reaction')
  2309. ->setActor('users', 'alice')
  2310. ->setObject('files', 'file64');
  2311. $status = $manager->save($comment);
  2312. $this->assertTrue($status);
  2313. }
  2314. public function providerTestReactionMessageSize(): array {
  2315. return [
  2316. ['a', false],
  2317. ['1', false],
  2318. ['👍', true],
  2319. ['👍👍', false],
  2320. ['👍🏽', true],
  2321. ['👨🏽‍💻', true],
  2322. ['👨🏽‍💻👍', false],
  2323. ];
  2324. }
  2325. /**
  2326. * @dataProvider providerTestReactionsSummarizeOrdered
  2327. */
  2328. public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch): void {
  2329. $this->skipIfNotSupport4ByteUTF();
  2330. $manager = $this->getManager();
  2331. $processedComments = $this->proccessComments($comments);
  2332. $comment = end($processedComments);
  2333. $actual = $manager->get($comment->getParentId());
  2334. if ($isFullMatch) {
  2335. $this->assertSame($expected, $actual->getReactions());
  2336. } else {
  2337. $subResult = array_slice($actual->getReactions(), 0, count($expected));
  2338. $this->assertSame($expected, $subResult);
  2339. }
  2340. }
  2341. public function providerTestReactionsSummarizeOrdered(): array {
  2342. return [
  2343. [
  2344. [
  2345. ['message', 'alice', 'comment', null],
  2346. ['👍', 'alice', 'reaction', 'message#alice'],
  2347. ],
  2348. ['👍' => 1],
  2349. true,
  2350. ],
  2351. [
  2352. [
  2353. ['message', 'alice', 'comment', null],
  2354. ['👎', 'John', '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. ['🏰', 'Luke', 'reaction', 'message#alice'],
  2371. ['⚙️', 'Luke', 'reaction', 'message#alice'],
  2372. ['🚨', 'Luke', 'reaction', 'message#alice'],
  2373. ['👥', 'Luke', 'reaction', 'message#alice'],
  2374. ['👍', 'Paul', 'reaction', 'message#alice'],
  2375. ['👍', 'Peter', 'reaction', 'message#alice'],
  2376. ['💜', 'Matthew', 'reaction', 'message#alice'],
  2377. ['💜', 'Mark', 'reaction', 'message#alice'],
  2378. ['💜', 'Luke', 'reaction', 'message#alice'],
  2379. ],
  2380. [
  2381. '💜' => 3,
  2382. '👍' => 2,
  2383. ],
  2384. false,
  2385. ],
  2386. ];
  2387. }
  2388. }