ManagerTest.php 94 KB

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