From 1dd6211e3e9c208313ee96f6b8398ba8521b14a1 Mon Sep 17 00:00:00 2001 From: Miro-Collas <39207573+Miro-Collas@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:49:49 -0400 Subject: [PATCH 1/9] Handle pages in root namespace --- event/PageSaveEvent.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/event/PageSaveEvent.php b/event/PageSaveEvent.php index 682d3b7..64e0ee3 100644 --- a/event/PageSaveEvent.php +++ b/event/PageSaveEvent.php @@ -31,9 +31,16 @@ public function getEventType(): ?string /** * Root namespace of the page. + * Handle case of page being in root namespace */ public function getNamespace(): string { + $pos = strpos($this->id, ':'); + if($pos === false) + { + return (''); + } + return explode(':', $this->id, 2)[0]; } From 1b0b30df49ebe70be5ac4b7f5c2b3e3bf7e0a0a6 Mon Sep 17 00:00:00 2001 From: Miro-Collas <39207573+Miro-Collas@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:50:46 -0400 Subject: [PATCH 2/9] Handle pages in root namespace --- helper/Config.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helper/Config.php b/helper/Config.php index 63d6386..75feb79 100644 --- a/helper/Config.php +++ b/helper/Config.php @@ -40,7 +40,10 @@ public function isValidNamespace(string $namespace): bool } $namespaces = explode(',', $this->namespaces); - + // Handle root namespace + if ($namespace === '') { + return in_array(':', $namespaces, true); + } return in_array($namespace, $namespaces, true); } } From 74bd4dd64a47476acc0bb24007e07cd320c2741f Mon Sep 17 00:00:00 2001 From: Miro-Collas <39207573+Miro-Collas@users.noreply.github.com> Date: Thu, 7 Sep 2023 23:40:50 -0400 Subject: [PATCH 3/9] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index cc30d8d..f55d715 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,7 @@ Download the latest release from [Tags] page and install the plugin using the 1. Create an Incoming Webhook on slack: https://api.slack.com/messaging/webhooks#create_a_webhook 2. Enter the webhook into the slacknotifier configuration section in DokuWiki's Configuration Settings + +## Discord + +This plugin will work for discord as well, if you append /slack to the discord webhook url; see https://birdie0.github.io/discord-webhooks-guide/other/slack_formatting.html From 39104e686ee97a99a0acd2619e801f4af8ea4144 Mon Sep 17 00:00:00 2001 From: Miro-Collas <39207573+Miro-Collas@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:55:12 -0400 Subject: [PATCH 4/9] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index f55d715..d97d6af 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ Download the latest release from [Tags] page and install the plugin using the 2. Enter the webhook into the slacknotifier configuration section in DokuWiki's Configuration Settings +## Root Namespace + +To incldue the root namespace, simply put a : in the namespace field in the config. + ## Discord This plugin will work for discord as well, if you append /slack to the discord webhook url; see https://birdie0.github.io/discord-webhooks-guide/other/slack_formatting.html From 39c3047e4ea2779c6a6826014e3c50f5c7c705ed Mon Sep 17 00:00:00 2001 From: Miro-Collas <39207573+Miro-Collas@users.noreply.github.com> Date: Tue, 23 Jan 2024 18:36:57 -0500 Subject: [PATCH 5/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d97d6af..5ff498f 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Download the latest release from [Tags] page and install the plugin using the ## Root Namespace -To incldue the root namespace, simply put a : in the namespace field in the config. +To include the root namespace, simply put a : in the namespace field in the config. ## Discord From 8d597a72c0752d7475e3f02a29c7ee60b9a036dc Mon Sep 17 00:00:00 2001 From: Miro-Collas <39207573+Miro-Collas@users.noreply.github.com> Date: Tue, 23 Jan 2024 19:00:38 -0500 Subject: [PATCH 6/9] Update PageSaveEvent.php --- event/PageSaveEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event/PageSaveEvent.php b/event/PageSaveEvent.php index 64e0ee3..93630ff 100644 --- a/event/PageSaveEvent.php +++ b/event/PageSaveEvent.php @@ -38,7 +38,7 @@ public function getNamespace(): string $pos = strpos($this->id, ':'); if($pos === false) { - return (''); + return ''; } return explode(':', $this->id, 2)[0]; From 0a8fe8ba5019969a70b63b6e437c647957742008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 26 Jan 2024 00:14:23 +0200 Subject: [PATCH 7/9] Remove discord note --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 5ff498f..0478bdf 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,4 @@ Download the latest release from [Tags] page and install the plugin using the ## Root Namespace -To include the root namespace, simply put a : in the namespace field in the config. - -## Discord - -This plugin will work for discord as well, if you append /slack to the discord webhook url; see https://birdie0.github.io/discord-webhooks-guide/other/slack_formatting.html +To include the root namespace, simply put a `:` in the namespace field in the config. From fd7d520c35098530455d3a0600d0372cf293bb5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 26 Jan 2024 00:15:49 +0200 Subject: [PATCH 8/9] Refactor to return : for root namespace This would be in pair of the other change --- event/PageSaveEvent.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/event/PageSaveEvent.php b/event/PageSaveEvent.php index 93630ff..b345395 100644 --- a/event/PageSaveEvent.php +++ b/event/PageSaveEvent.php @@ -31,14 +31,13 @@ public function getEventType(): ?string /** * Root namespace of the page. - * Handle case of page being in root namespace */ public function getNamespace(): string { + // Handle special case of page being in root namespace $pos = strpos($this->id, ':'); - if($pos === false) - { - return ''; + if ($pos === false) { + return ':'; } return explode(':', $this->id, 2)[0]; From 114644185c90de17dfd8028d73cf43eddb7d6fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 26 Jan 2024 00:16:39 +0200 Subject: [PATCH 9/9] Revert unwanted change. Root namespace is reported as colon --- helper/Config.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/helper/Config.php b/helper/Config.php index 75feb79..63d6386 100644 --- a/helper/Config.php +++ b/helper/Config.php @@ -40,10 +40,7 @@ public function isValidNamespace(string $namespace): bool } $namespaces = explode(',', $this->namespaces); - // Handle root namespace - if ($namespace === '') { - return in_array(':', $namespaces, true); - } + return in_array($namespace, $namespaces, true); } }