mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Bugfix: Squash empty tags when saving an edit to a page
This commit is contained in:
parent
1d540d3d8a
commit
83c9d527cb
2 changed files with 10 additions and 6 deletions
|
@ -28,7 +28,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
||||||
- Add new `email_debug_dontsend` setting for debugging emails sent by Pepperminty Wiki
|
- Add new `email_debug_dontsend` setting for debugging emails sent by Pepperminty Wiki
|
||||||
- Fixed pressing alt + enter to open a search in a new tab - it should no longer fail and briefly prompt to allow pop-ups
|
- Fixed pressing alt + enter to open a search in a new tab - it should no longer fail and briefly prompt to allow pop-ups
|
||||||
- Squashed a bug in the new upgraded get/set_array_simple search optimisation
|
- Squashed a bug in the new upgraded get/set_array_simple search optimisation
|
||||||
- Update Parsedown to squash warning in PHP 7.4+
|
- Updated Parsedown to squash warning in PHP 7.4+
|
||||||
|
- Trailing commas in the tags box will no longer result in empty tags being added to pages.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Improved the search indexing system performance - again
|
- Improved the search indexing system performance - again
|
||||||
|
|
|
@ -108,8 +108,7 @@ register_module([
|
||||||
|
|
||||||
$content = "<h1>$title</h1>\n";
|
$content = "<h1>$title</h1>\n";
|
||||||
$page_tags = implode(", ", (!empty($pageindex->{$env->page}->tags)) ? $pageindex->{$env->page}->tags : []);
|
$page_tags = implode(", ", (!empty($pageindex->{$env->page}->tags)) ? $pageindex->{$env->page}->tags : []);
|
||||||
if(!$env->is_logged_in and $settings->anonedits)
|
if(!$env->is_logged_in and $settings->anonedits) {
|
||||||
{
|
|
||||||
$content .= "<p><strong>Warning: You are not logged in! Your IP address <em>may</em> be recorded.</strong></p>";
|
$content .= "<p><strong>Warning: You are not logged in! Your IP address <em>may</em> be recorded.</strong></p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,13 +409,17 @@ window.addEventListener("load", function(event) {
|
||||||
// Read in the new page tags, so long as there are actually some
|
// Read in the new page tags, so long as there are actually some
|
||||||
// tags to read in
|
// tags to read in
|
||||||
$page_tags = [];
|
$page_tags = [];
|
||||||
if(strlen(trim($_POST["tags"])) > 0)
|
if(strlen(trim($_POST["tags"])) > 0) {
|
||||||
{
|
|
||||||
$page_tags = explode(",", $_POST["tags"]);
|
$page_tags = explode(",", $_POST["tags"]);
|
||||||
// Trim off all the whitespace
|
// Trim off all the whitespace
|
||||||
foreach($page_tags as &$tag)
|
foreach($page_tags as &$tag) {
|
||||||
$tag = trim($tag);
|
$tag = trim($tag);
|
||||||
}
|
}
|
||||||
|
// Ignore empty tags
|
||||||
|
$page_tags = array_filter($page_tags, function($value) {
|
||||||
|
return !is_null($value) && $value !== '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Check for edit conflicts
|
// Check for edit conflicts
|
||||||
if(!empty($pageindex->{$env->page}) && file_exists($env->storage_prefix . $pageindex->{$env->page}->filename))
|
if(!empty($pageindex->{$env->page}) && file_exists($env->storage_prefix . $pageindex->{$env->page}->filename))
|
||||||
|
|
Loading…
Reference in a new issue