ManagerTest.php 94 KB

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