To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 85d3676c authored by vermeul's avatar vermeul
Browse files

ensure hashtag symbol always is present when inserting and updating categories

parent 1e1bd01b
......@@ -544,6 +544,11 @@ EOT;
return;
}
# make sure hashtags always start with a hash symbol: #
if (substr($hashtag, 0,1) != '#') {
$hashtag = '#'.$hashtag;
}
$dbw->insert(
'yata_category',
array(
......@@ -570,12 +575,15 @@ EOT;
$new_category_name = $category->parent_name . "/".$new_category;
}
$category_exists = self::get_category($dbw, $new_category_name);
if ($category_exists) {
if ($category_exists && $category_exists->id != $category->id) {
throw new Exception("Error updating category - already exists: $new_category_name");
}
$set["name"] = $args["name"];
}
if (array_key_exists("hashtag", $args) ) {
if (substr($args["hashtag"], 0,1) != '#') {
$args["hashtag"] = '#'.$args["hashtag"];
}
$set["hashtag"] = $args["hashtag"];
}
if (array_key_exists("description", $args) ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment