Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53509

Digest mails have broken bynameondate

XMLWordPrintable

    • MOODLE_30_STABLE
    • MOODLE_30_STABLE
    • MDL-53509-master
    • Hide
      Pre-reqs.
      1. A moodle site that can send emails.
      2. Two users with valid email addresses.
      Test
      1. Create a course + forum (in optional mode).
      2. Enrol two students.
      3. As the first student subscribe to the forum and change your digest preference to 'Complete'.
      4. As the second student subscribe to the forum and change your digest preference to 'Subjects'
      5. As a teacher post two items in the forum, ticking the "Mail now" box.
      6. Make the following change to mod/forum/lib.php:

        diff --git a/mod/forum/lib.php b/mod/forum/lib.php
        index 29f4f6d..5c83469 100644
        --- a/mod/forum/lib.php
        +++ b/mod/forum/lib.php
        @@ -902,6 +902,8 @@ function forum_cron() {
             $weekago = $timenow - (7 * 24 * 3600);
             $DB->delete_records_select('forum_queue', "timemodified < ?", array($weekago));
             mtrace ('Cleaned old digest records');
        +    $digesttime = $timenow - 1;
        +    $CFG->digestmailtimelast = $weekago - 1;
         
             if ($CFG->digestmailtimelast < $digesttime and $timenow > $digesttime) {
        

      7. Run the forum scheduled task:

        php admin/tool/task/cli/schedule_task.php --execute="\mod_forum\task\cron_task"
        

      8. Check your e-mail
        1. Confirm that the author name shows up correctly.
        2. View the text version of the mail and confirm the same.
      Show
      Pre-reqs. A moodle site that can send emails. Two users with valid email addresses. Test Create a course + forum (in optional mode). Enrol two students. As the first student subscribe to the forum and change your digest preference to 'Complete'. As the second student subscribe to the forum and change your digest preference to 'Subjects' As a teacher post two items in the forum, ticking the "Mail now" box. Make the following change to mod/forum/lib.php: diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 29f4f6d..5c83469 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -902,6 +902,8 @@ function forum_cron() { $weekago = $timenow - (7 * 24 * 3600); $DB->delete_records_select('forum_queue', "timemodified < ?", array($weekago)); mtrace ('Cleaned old digest records'); + $digesttime = $timenow - 1; + $CFG->digestmailtimelast = $weekago - 1;   if ($CFG->digestmailtimelast < $digesttime and $timenow > $digesttime) { Run the forum scheduled task: php admin/tool/task/cli/schedule_task.php --execute="\mod_forum\task\cron_task" Check your e-mail Confirm that the author name shows up correctly. View the text version of the mail and confirm the same.

      Seems something escaped testing in MDL-52137 and the bynameondate is broken for both types of digest mail in HTML format.

      Simple issue:

      diff --git a/mod/forum/templates/forum_post_emaildigestbasic_htmlemail.mustache b/mod/forum/templates/forum_post_emaildigestbasic_htmlemail.mustache
      index 2697d23..1bfd139 100644
      --- a/mod/forum/templates/forum_post_emaildigestbasic_htmlemail.mustache
      +++ b/mod/forum/templates/forum_post_emaildigestbasic_htmlemail.mustache
      @@ -44,7 +44,7 @@
       <div>
         <a target="_blank" href="{{{ permalink }}}">{{{ subject }}}</a>
         {{# str }} bynameondate, forum, {
      -          "name": {{# quote }}<a target=\"_blank\" href=\"{{{ authorlink }}}\">{{ authorfullname }}</a>{{/ quote }},
      +          "name": {{# quote }}<a target="_blank" href="{{{ authorlink }}}">{{ authorfullname }}</a>{{/ quote }},
                 "date": {{# quote }}{{ postdate }}{{/ quote }}
             } {{/ str }}
       </div>
      diff --git a/mod/forum/templates/forum_post_emaildigestfull_htmlemail.mustache b/mod/forum/templates/forum_post_emaildigestfull_htmlemail.mustache
      index 2dc5779..9ec24f4 100644
      --- a/mod/forum/templates/forum_post_emaildigestfull_htmlemail.mustache
      +++ b/mod/forum/templates/forum_post_emaildigestfull_htmlemail.mustache
      @@ -88,7 +88,7 @@
                   </div>
                   <div class="author">
                       {{# str }} bynameondate, forum, {
      -                        "name": {{# quote }}<a target=\"_blank\" href=\"{{{ authorlink }}}\">{{ authorfullname }}</a>{{/ quote }},
      +                        "name": {{# quote }}<a target="_blank" href="{{{ authorlink }}}">{{ authorfullname }}</a>{{/ quote }},
                               "date": {{# quote }}{{ postdate }}{{/ quote }}
                           } {{/ str }}
                   </div>
      

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            David Monllaó David Monllaó
            Mark Nelson Mark Nelson
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.