Skip to content

Commit

Permalink
Merge pull request #17 from durenadev/MDLSITE-7830
Browse files Browse the repository at this point in the history
MDLSITE-7830: Unnamed stash deletion confirmation by the date
  • Loading branch information
mudrd8mz authored Nov 25, 2024
2 parents f01dda5 + c8aa068 commit 33d9a8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion stash.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,17 @@
if (!$confirm) {
$output = $PAGE->get_renderer('local_amos');
echo $output->header();
$name = trim($stash->name);
if (empty($name)) {
// If name is empty, use the time of creation or modification.
$time = $stash->timemodified;
if (!$time) {
$time = $stash->timecreated;
}
$name = userdate($time, get_string('strftimedaydatetime', 'langconfig'));
}
echo $output->confirm(
get_string('stashdropconfirm', 'local_amos', s($stash->name)),
get_string('stashdropconfirm', 'local_amos', s($name)),
new moodle_url($PAGE->url, [
'confirm' => true,
'drop' => $drop,
Expand Down

0 comments on commit 33d9a8a

Please sign in to comment.