1
0

ManagerTest.php 95 KB

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