Skip to content

Commit 33d9a8a

Browse files
authored
Merge pull request #17 from durenadev/MDLSITE-7830
MDLSITE-7830: Unnamed stash deletion confirmation by the date
2 parents f01dda5 + c8aa068 commit 33d9a8a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

stash.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,17 @@
9595
if (!$confirm) {
9696
$output = $PAGE->get_renderer('local_amos');
9797
echo $output->header();
98+
$name = trim($stash->name);
99+
if (empty($name)) {
100+
// If name is empty, use the time of creation or modification.
101+
$time = $stash->timemodified;
102+
if (!$time) {
103+
$time = $stash->timecreated;
104+
}
105+
$name = userdate($time, get_string('strftimedaydatetime', 'langconfig'));
106+
}
98107
echo $output->confirm(
99-
get_string('stashdropconfirm', 'local_amos', s($stash->name)),
108+
get_string('stashdropconfirm', 'local_amos', s($name)),
100109
new moodle_url($PAGE->url, [
101110
'confirm' => true,
102111
'drop' => $drop,

0 commit comments

Comments
 (0)