From 8d36730fce82f563f466699eb40e345add31d900 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 31 Oct 2024 19:22:04 +0100 Subject: [PATCH] imp: Import Pocket tags as links tags --- locales/fr_FR/LC_MESSAGES/main.mo | Bin 58922 -> 58278 bytes locales/fr_FR/LC_MESSAGES/main.po | 62 +++++++-------------- src/controllers/importations/Pocket.php | 2 - src/jobs/PocketImportator.php | 48 ++++++++--------- src/models/Importation.php | 6 --- src/models/dao/Message.php | 2 + src/views/importations/pocket/show.phtml | 26 --------- tests/jobs/PocketImportatorTest.php | 66 ++--------------------- 8 files changed, 50 insertions(+), 162 deletions(-) diff --git a/locales/fr_FR/LC_MESSAGES/main.mo b/locales/fr_FR/LC_MESSAGES/main.mo index 4cf0e707f17c4c85dc4d77c6a7acfb3a075fcecf..c7f8c5eb5cbd7edea88e7e50022933eb71891439 100644 GIT binary patch delta 12128 zcmYk?34Bf0+Q;!lLXbIQ8Mm19+F%=sF|l*9|D^H(ukCu$lq7|LLMoPu?5C-%YH*c8)i8B-Q# zVk)l2AiRJjjPaOT6nLh&hlyA$*_dWn3*+&5^u?uE9M@tfZpPAh5KG}%R0pr1`u-Sw zFs8OK)vzkI!))w~?_e^|H+LyyP!XGAOd}kDmvAFC!hx2G!sI^v7YSo=-qc;Y(Nn=c8s~E2@Kes0W`%U4IKTuzRSPdw{Ht z@%&9e4{S*H^nlK&2Ku2I9E0k}EL2C@YdZ=6X(Zyb+-I0-d?IjEUgit4}yRJ(go zOL7V|kaM_5@Bg>1Vr*;s8cs$vl!vNkW-J9Q!F=?=^{5VP!=bnrbz_xu`+$1Rrl^s&c6m4SChv`v zu|MiTGcX0;Mm^^g_QRX#=}94-&qZe2tU^8b8b;$i)YOOa@u-i`c+}K)MU8Ma>NQ=D zdeAvc#5<@>S+>0~Ph)*l$Ce@gGw<+EN4(vh`7c4C5%a4xY=xz;8zx{sjKbGYQ@sJ% zuVy!DrXHamdS@9Efx)P?PDHiS6g3m=P)jocb>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xbi5rUMJCOWhP2av~3V;#n+&{u&0yaN-6PCCFk130BlujEtXMPT}d}Bb#)@Nt_F?=Qlik z5#`&2ruRF}*SFWS!rj#IG8Fu4S19>6_FORP71Yt0Xk3Wrze(j^#7!cMXw8Xe%p~+d z(W|4^rYd? zi)c=4A*K@g4rJR4`;qH-UYjj}LWP3Vd{p=ZINwrVh{g_MVXQ~gqI{5e`Y20snAl7G zTw*)1gzzW6CdzPM8PqY|;6zjR(2Da?t{36?^swNWE zsM~^VsQ-d^K_~3tN#2lh7kr<1a=5hq=cowf=JD8=Ge6_tCs*JQTaKijUlp8n7|8WH zRuGkllH`9<-z!#x*x6r%_ju_>r;>KkBz*JEA?IAG5Vu!;5&G6a3=hgy3buLoM55Db}D)M~?LqYqE76=cW>|#BAzbCH}VOyr~;Q z^dSG2=tEgYl-7Sf6=zKD9J4o^BLCgi?Za?e|B&*tgcqF~fDNc$h&qZ=mrlNk_<;Nf z>bQoZ@ek}zY_#$a{d`Vq;*9^2k7%1MMh+y%cfmtw>^qOiOvI&-+eo4gX%#c=AAD0d*99M>uI zAsxl z7bYTUNJmr3+OK~SD~Wh=9iyx&kDy#i1$!it@1(rSUeknfamuxAn+5y-5tWOGVz!c^ zQ`6p{a!bm+h^Cb9;cr;hp5LYm?C}ZSBRX>~h!|+=C)jJ>!d29jAPy1B^!uNVUpO%t z-?10ApH|5;X`NkwkN1yppGm*YdxJ&MsUuJuPEo z_JU5e!v+O?4%?(m9(swBXVj(F;PN==E*uU&U@d6&7M;Ck1P3Fc&4#xPgT@YI5)^UrrU6jP*e(+2r@ zlUsYZQs{GtoEnquV$>7eu9Q^WJR~c1%y>I= zr)st\n" "Language-Team: \n" "Language: fr_FR\n" @@ -79,9 +79,9 @@ msgstr "L’une des thématiques associées n’existe pas." #: controllers/Messages.php:94 controllers/Messages.php:145 #: controllers/Sessions.php:206 controllers/collections/Read.php:87 #: controllers/collections/Read.php:168 controllers/collections/Read.php:243 -#: controllers/importations/Opml.php:79 controllers/importations/Pocket.php:110 -#: controllers/importations/Pocket.php:157 -#: controllers/importations/Pocket.php:258 +#: controllers/importations/Opml.php:79 controllers/importations/Pocket.php:109 +#: controllers/importations/Pocket.php:155 +#: controllers/importations/Pocket.php:256 #: controllers/links/Collections.php:159 controllers/links/Read.php:46 #: controllers/links/Read.php:95 controllers/links/Read.php:144 #: controllers/links/Read.php:192 controllers/my/Avatar.php:44 @@ -199,11 +199,11 @@ msgstr "Vous avez déjà une importation OPML en cours." msgid "This file cannot be uploaded." msgstr "Ce fichier ne peut pas être téléversé." -#: controllers/importations/Pocket.php:93 +#: controllers/importations/Pocket.php:92 msgid "You already have an ongoing Pocket importation." msgstr "Vous avez déjà une importation Pocket en cours." -#: controllers/importations/Pocket.php:101 +#: controllers/importations/Pocket.php:100 msgid "You didn’t authorize us to access your Pocket data." msgstr "Vous n’avez pas autorisé l’accès à vos données Pocket." @@ -249,19 +249,19 @@ msgstr "" "Nous avons essayé d’importer depuis Pocket, mais vous n’avez pas autorisé " "l’accès à vos données Pocket." -#: jobs/PocketImportator.php:119 +#: jobs/PocketImportator.php:118 msgid "Pocket links" msgstr "Liens Pocket" -#: jobs/PocketImportator.php:123 +#: jobs/PocketImportator.php:122 msgid "All your links imported from Pocket." msgstr "Tous vos liens importés depuis Pocket." -#: jobs/PocketImportator.php:127 +#: jobs/PocketImportator.php:126 msgid "Pocket favorite" msgstr "Favoris Pocket" -#: jobs/PocketImportator.php:131 +#: jobs/PocketImportator.php:130 msgid "All your favorites imported from Pocket." msgstr "Tous vos favoris importés depuis Pocket." @@ -1360,48 +1360,24 @@ msgstr "" "nouveaux liens dans vos collections et/ou signets." #: views/importations/pocket/show.phtml:86 -msgid "Import your links by ignoring the tags" -msgstr "Importer vos liens en ignorant les tags" - -#: views/importations/pocket/show.phtml:91 -#, php-format -msgid "" -"%s will import your links in a collection named “Pocket links”, your tags " -"will be ignored." -msgstr "" -"%s importera vos liens dans une collection nommée « Liens Pocket », vos tags " -"seront ignorés." - -#: views/importations/pocket/show.phtml:95 -#, php-format -msgid "" -"%s will import your links in a collection named “Pocket links” and in " -"collections named after your tags (not recommended if you have a lot of " -"tags)." -msgstr "" -"%s importera vos liens dans une collection nommée « Liens Pocket » et dans " -"des collections nommées d’après vos tags (déconseillé si vous avez de " -"nombreux tags)." - -#: views/importations/pocket/show.phtml:112 msgid "Import non-archived links in your bookmarks" msgstr "Importer vos liens non-archivés dans vos signets" -#: views/importations/pocket/show.phtml:117 +#: views/importations/pocket/show.phtml:91 #, php-format msgid "%s will import your non-archived Pocket links in your bookmarks." msgstr "%s importera vos liens Pocket non-archivés dans vos signets." -#: views/importations/pocket/show.phtml:121 +#: views/importations/pocket/show.phtml:95 #, php-format msgid "%s will leave your bookmarks unchanged." msgstr "%s ne modifiera pas vos signets." -#: views/importations/pocket/show.phtml:138 +#: views/importations/pocket/show.phtml:112 msgid "Import your Pocket favorites in a dedicated collection" msgstr "Importer vos favoris Pocket dans une collection dédiée" -#: views/importations/pocket/show.phtml:143 +#: views/importations/pocket/show.phtml:117 #, php-format msgid "" "%s doesn’t provide favorites, but it’ll import them in a collection named " @@ -1410,21 +1386,21 @@ msgstr "" "%s ne propose pas de système de favoris, mais il les importera dans une " "collection appelée « Favoris Pocket »." -#: views/importations/pocket/show.phtml:147 +#: views/importations/pocket/show.phtml:121 #, php-format msgid "%s doesn’t provide favorites, so they’ll be ignored." msgstr "%s ne propose pas de système de favoris, ils seront donc ignorés." -#: views/importations/pocket/show.phtml:154 +#: views/importations/pocket/show.phtml:128 msgid "Start the import" msgstr "Démarrer l’importation" -#: views/importations/pocket/show.phtml:161 views/mastodon/show.phtml:93 +#: views/importations/pocket/show.phtml:135 views/mastodon/show.phtml:93 #, php-format msgid "connected with account %s" msgstr "connecté‧e avec le compte %s" -#: views/importations/pocket/show.phtml:170 +#: views/importations/pocket/show.phtml:144 msgid "Connect to Pocket" msgstr "Se connecter à Pocket" diff --git a/src/controllers/importations/Pocket.php b/src/controllers/importations/Pocket.php index e81ae10f..44828681 100644 --- a/src/controllers/importations/Pocket.php +++ b/src/controllers/importations/Pocket.php @@ -51,7 +51,6 @@ public function show(Request $request): Response * Initialize a new Pocket importation and register a PocketImportator job. * * @request_param string $csrf - * @request_param boolean $ignore_tags * @request_param boolean $import_bookmarks * @request_param boolean $import_favorites * @@ -112,7 +111,6 @@ public function import(Request $request): Response } $options = [ - 'ignore_tags' => $request->paramBoolean('ignore_tags'), 'import_bookmarks' => $request->paramBoolean('import_bookmarks'), 'import_favorites' => $request->paramBoolean('import_favorites'), ]; diff --git a/src/jobs/PocketImportator.php b/src/jobs/PocketImportator.php index bf1adc59..5f5b0954 100644 --- a/src/jobs/PocketImportator.php +++ b/src/jobs/PocketImportator.php @@ -107,7 +107,6 @@ public function perform(int $importation_id): void * * @param array> $items * @param array{ - * 'ignore_tags': bool, * 'import_bookmarks': bool, * 'import_favorites': bool, * } $options @@ -144,6 +143,7 @@ public function importPocketItems(models\User $user, array $items, array $option $links_to_create = []; $collections_to_create = []; $links_to_collections_to_create = []; + $messages = []; foreach ($items as $item) { /** @var string */ @@ -163,29 +163,12 @@ public function importPocketItems(models\User $user, array $items, array $option $collection_ids[] = $bookmarks_collection->id; } - if (is_array($item['tags'] ?? null) && !$options['ignore_tags']) { - // we want to create a collection per tag - $tags = array_keys($item['tags']); - foreach ($tags as $tag) { - if (isset($collection_ids_by_names[$tag])) { - // a collection named by the current tag already - // exists, just pick its id - $collection_ids[] = $collection_ids_by_names[$tag]; - } else { - // the collection needs to be created - $collection = models\Collection::init($user->id, $tag, '', false); - $collection->created_at = \Minz\Time::now(); - - $collections_to_create[] = $collection; - - // add the collection to the map array to avoid - // creating it again next time we find it - $collection_ids_by_names[$collection->name] = $collection->id; - - // and add the collection id to the array which stores - // the link collections - $collection_ids[] = $collection->id; - } + $tags = []; + + if (is_array($item['tags'] ?? null)) { + foreach (array_keys($item['tags']) as $tag) { + $tag = str_replace(' ', '_', $tag); + $tags[] = $tag; } } @@ -208,6 +191,8 @@ public function importPocketItems(models\User $user, array $items, array $option $link->title = $item['given_title']; } + $link->setTags($tags); + // In normal cases, created_at is set on save() call. Since we // add links via the bulkInsert call, we have to set created_at // first, or it would fail because of the not-null constraint. @@ -245,12 +230,27 @@ public function importPocketItems(models\User $user, array $items, array $option $link_to_collection->created_at = $published_at; $links_to_collections_to_create[] = $link_to_collection; } + + // We create a message containing the list of tags if any. + if ($tags) { + $formatted_tags = array_map(function ($tag) { + return "#{$tag}"; + }, $tags); + + $content = implode(' ', $formatted_tags); + + $message = new models\Message($user->id, $link_id, $content); + $message->created_at = $published_at; + + $messages[] = $message; + } } // Finally, let the big import (in DB) begin! models\Link::bulkInsert($links_to_create); models\Collection::bulkInsert($collections_to_create); models\LinkToCollection::bulkInsert($links_to_collections_to_create); + models\Message::bulkInsert($messages); // Delete the collections if they are empty at the end of the // importation. diff --git a/src/models/Importation.php b/src/models/Importation.php index 17dc3ea7..06330662 100644 --- a/src/models/Importation.php +++ b/src/models/Importation.php @@ -86,7 +86,6 @@ public function fail(string $error): void /** * @return array{ - * 'ignore_tags': bool, * 'import_bookmarks': bool, * 'import_favorites': bool, * } @@ -98,15 +97,10 @@ public function pocketOptions(): array } $clean_options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; - if (is_bool($this->options['ignore_tags'])) { - $clean_options['ignore_tags'] = $this->options['ignore_tags']; - } - if (is_bool($this->options['import_bookmarks'])) { $clean_options['import_bookmarks'] = $this->options['import_bookmarks']; } diff --git a/src/models/dao/Message.php b/src/models/dao/Message.php index 360a939d..768684b3 100644 --- a/src/models/dao/Message.php +++ b/src/models/dao/Message.php @@ -12,6 +12,8 @@ */ trait Message { + use BulkQueries; + /** * Return the link messages, orderer by creation date * diff --git a/src/views/importations/pocket/show.phtml b/src/views/importations/pocket/show.phtml index b5886254..56a01662 100644 --- a/src/views/importations/pocket/show.phtml +++ b/src/views/importations/pocket/show.phtml @@ -71,32 +71,6 @@
-
- - - - -

- - - - - - - -

-
-
true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -68,7 +67,6 @@ public function testImportPocketItemsDoesNotImportInBookmarksIfOption(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => false, 'import_favorites' => true, ]; @@ -99,7 +97,6 @@ public function testImportPocketItemsImportInFavorite(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -132,7 +129,6 @@ public function testImportPocketItemsDoesNotKeepFavoriteCollectionIfEmpty(): voi ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -158,7 +154,6 @@ public function testImportPocketItemsDoesNotImportInFavoriteIfOption(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => false, ]; @@ -186,7 +181,6 @@ public function testImportPocketItemsImportInDefaultCollection(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -212,7 +206,6 @@ public function testImportPocketItemsImportDoesNotKeepDefaultCollectionIfEmpty() $url = $this->fake('url'); $items = []; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -223,40 +216,7 @@ public function testImportPocketItemsImportDoesNotKeepDefaultCollectionIfEmpty() $this->assertNull($collection); } - public function testImportPocketItemsDoesNotImportTags(): void - { - $importator = new PocketImportator(); - $user = UserFactory::create(); - /** @var string */ - $url = $this->fake('url'); - /** @var string */ - $tag = $this->fake('word'); - $items = [ - [ - 'given_url' => $url, - 'resolved_url' => $url, - 'favorite' => '0', - 'status' => '1', - 'tags' => [ - $tag => ['item_id' => 'some id', 'tag' => $tag], - ], - ], - ]; - $options = [ - 'ignore_tags' => true, - 'import_bookmarks' => true, - 'import_favorites' => true, - ]; - - $importator->importPocketItems($user, $items, $options); - - $link = models\Link::findBy(['url' => $url]); - $this->assertNotNull($link); - $collection = models\Collection::findBy(['name' => $tag]); - $this->assertNull($collection); - } - - public function testImportPocketItemsImportTagsIfOption(): void + public function testImportPocketItemsImportTags(): void { $importator = new PocketImportator(); $user = UserFactory::create(); @@ -279,29 +239,18 @@ public function testImportPocketItemsImportTagsIfOption(): void ], ]; $options = [ - 'ignore_tags' => false, 'import_bookmarks' => true, 'import_favorites' => true, ]; $importator->importPocketItems($user, $items, $options); - $collection1 = models\Collection::findBy(['name' => $tag1]); - $collection2 = models\Collection::findBy(['name' => $tag2]); - $this->assertNotNull($collection1); - $this->assertNotNull($collection2); $link = models\Link::findBy(['url' => $url]); $this->assertNotNull($link); - $db_links_to_collection1 = models\LinkToCollection::findBy([ - 'link_id' => $link->id, - 'collection_id' => $collection1->id, - ]); - $db_links_to_collection2 = models\LinkToCollection::findBy([ - 'link_id' => $link->id, - 'collection_id' => $collection2->id, - ]); - $this->assertNotNull($db_links_to_collection1); - $this->assertNotNull($db_links_to_collection2); + $this->assertEquals([$tag1 => $tag1, $tag2 => $tag2], $link->tags); + $messages = $link->messages(); + $this->assertSame(1, count($messages)); + $this->assertSame("#{$tag1} #{$tag2}", $messages[0]->content); } public function testImportPocketItemsUsesTimeAddedIfItExists(): void @@ -323,7 +272,6 @@ public function testImportPocketItemsUsesTimeAddedIfItExists(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -365,7 +313,6 @@ public function testImportPocketItemsDoesNotDuplicateAGivenUrlAlreadyThere(): vo ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -412,7 +359,6 @@ public function testImportPocketItemsDoesNotDuplicateAResolvedUrlAlreadyThere(): ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -449,7 +395,6 @@ public function testImportPocketItemsSetsResolvedTitle(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ]; @@ -479,7 +424,6 @@ public function testImportPocketItemsSetsGivenTitle(): void ], ]; $options = [ - 'ignore_tags' => true, 'import_bookmarks' => true, 'import_favorites' => true, ];