From cefd48e94f5cc86c9962c2597162db0f7af5cf3f Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 13 Mar 2024 23:36:09 +0000 Subject: [PATCH 1/2] [tags] redirect to view page after updating tags, fixes #1103 --- ext/tag_categories/main.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php index 9ecfcdbde..c5011b261 100644 --- a/ext/tag_categories/main.php +++ b/ext/tag_categories/main.php @@ -74,6 +74,8 @@ public function onPageRequest(PageRequestEvent $event): void } if ($event->page_matches("tags/categories", method: "POST", permission: Permissions::EDIT_TAG_CATEGORIES)) { $this->page_update(); + $page->set_mode(PageMode::REDIRECT); + $page->set_redirect(make_link("tags/categories")); } } From cc8e4ffd47087cb006d65a07e473a589ed0fcdae Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 13 Mar 2024 23:34:33 +0000 Subject: [PATCH 2/2] [tags] fully separate tag_list and tag_categories, see #1103 --- ext/tag_categories/theme.php | 3 +++ ext/tag_list/main.php | 8 ++++++-- ext/tag_list/test.php | 5 +---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ext/tag_categories/theme.php b/ext/tag_categories/theme.php index 31af0a706..dc61b9e2c 100644 --- a/ext/tag_categories/theme.php +++ b/ext/tag_categories/theme.php @@ -103,6 +103,9 @@ public function show_tag_categories(Page $page, array $tc_dict): void '; // add html to stuffs + $page->set_title("Tag Categories"); + $page->set_heading("Tag Categories"); + $page->add_block(new NavBlock()); $page->add_block(new Block("Editing", $html, "main", 10)); } diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 934ea2c1d..5e6fba444 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -53,21 +53,25 @@ public function onPageRequest(PageRequestEvent $event): void } switch ($sub) { - default: case 'map': $this->theme->set_heading("Tag Map"); $this->theme->set_tag_list($this->build_tag_map($starts_with, $tags_min)); + $this->theme->display_page($page); break; case 'alphabetic': $this->theme->set_heading("Alphabetic Tag List"); $this->theme->set_tag_list($this->build_tag_alphabetic($starts_with, $tags_min)); + $this->theme->display_page($page); break; case 'popularity': $this->theme->set_heading("Tag List by Popularity"); $this->theme->set_tag_list($this->build_tag_popularity($tags_min)); + $this->theme->display_page($page); + break; + default: + // don't display anything break; } - $this->theme->display_page($page); } elseif ($event->page_matches("tags")) { $page->set_mode(PageMode::REDIRECT); $page->set_redirect(make_link("tags/map")); diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php index a345508da..b58979c4e 100644 --- a/ext/tag_list/test.php +++ b/ext/tag_list/test.php @@ -7,7 +7,7 @@ class TagListTest extends ShimmiePHPUnitTestCase { /** @var string[] */ - private array $pages = ["map", "alphabetic", "popularity", "categories"]; + private array $pages = ["map", "alphabetic", "popularity"]; public function testTagList(): void { @@ -20,9 +20,6 @@ public function testTagList(): void $this->get_page('tags/popularity'); $this->assert_title('Tag List'); - $this->get_page('tags/categories'); - $this->assert_title('Tag List'); - # FIXME: test that these show the right stuff }