Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mute url regex display #189

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading