Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ 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

## Root Namespace

To incldue the root namespace, simply put a : in the namespace field in the config.
Comment thread
glensc marked this conversation as resolved.
Outdated

## 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
Comment thread
glensc marked this conversation as resolved.
Outdated
7 changes: 7 additions & 0 deletions event/PageSaveEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ('');
Comment thread
glensc marked this conversation as resolved.
Outdated
}

return explode(':', $this->id, 2)[0];
}

Expand Down
5 changes: 4 additions & 1 deletion helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public function isValidNamespace(string $namespace): bool
}

$namespaces = explode(',', $this->namespaces);

// Handle root namespace
if ($namespace === '') {
return in_array(':', $namespaces, true);
Comment thread
glensc marked this conversation as resolved.
Outdated
}
return in_array($namespace, $namespaces, true);
}
}