Skip to content

Commit

Permalink
Fix mute url regex display
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalkerl authored and brendanheywood committed Aug 5, 2024
1 parent 2f05062 commit 95be7c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions classes/form/override_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ public function definition() {
$mform->setType('url', PARAM_URL);
$urlregex = get_config('tool_heartbeat', 'muteurlregex');
if (!empty($urlregex)) {
$urlregex = stripslashes($urlregex);
// Strip backslashes and remove delimiters from the regex display.
$urlregexdisplay = substr(stripslashes($urlregex), 1, -1);
$mform->addRule('url', get_string('required'), 'required', null, 'client');
$mform->addRule('url', get_string('muteurlregex', 'tool_heartbeat', $urlregex), 'regex', $urlregex, 'client');
$mform->addElement('static', 'url_help', '', get_string('muteurlregex', 'tool_heartbeat', $urlregex));
$mform->addRule('url', get_string('muteurlregex', 'tool_heartbeat', $urlregexdisplay), 'regex', $urlregex, 'client');
$mform->addElement('static', 'url_help', '', get_string('muteurlregex', 'tool_heartbeat', $urlregexdisplay));
}

// Override until.
Expand Down
2 changes: 1 addition & 1 deletion lang/en/tool_heartbeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
$string['editmute'] = 'Edit mute';
$string['overriderestore'] = 'Fields have been pre-filled with information from a previous override.';
$string['noterequired'] = 'Please add some notes';
$string['muteurlregex'] = 'The URL must match the regex defined in settings: {$a}';
$string['muteurlregex'] = 'The URL must match the format defined in settings: {$a}';
$string['statusunknown'] = 'Unknown';
$string['settings:mutedefault'] = 'Default mute duration';
$string['settings:mutedefault:desc'] = 'Adjust the default duration of a check mute.';
Expand Down

0 comments on commit 95be7c8

Please sign in to comment.