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

Forum digest emails do not reflect timestart date for timed posts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.9.5, 3.0.3
    • 2.9.2, 3.0.2, 3.1
    • Forum
    • MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • MDL-51852-master
    • Hide

      Apologies - this issue is an absolute pita to test. Ping me if I got anything wrong. Testing the forum digests is hard.

      1. Navigate to Site administration -> Plugins -> Activity modules -> Forum
      2. Enabled "Timed posts"
      3. Modify your config.php to set:

        $CFG->maxeditingtime = 1;
        $CFG->digestmailtime = 9;
        $CFG->forum_enabletimedposts = 1;
        

      4. Navigate to a course and create a forum within it
      5. Create a new discussion and set a "Display start":
        1. For master, set the time to a few minutes in the future
        2. For older branches, set the time to the previous day
      6. Open your database and run a query along the lines of:

        UPDATE mdl_forum_posts SET modified = modified - 172800, created = created - 172800, mailnow = 1, mailed=0;
        

        (This is primarily to ensure that the non-master branches have a time older than the Display start time)

      7. Reset the digest last run time:

        UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast';
        

      8. Open mod/forum/lib.php in your editor and find where $digesttime is set in the forum_cron() function. Add the following one line later:

        $digesttime = $digesttime - 60;
        

        This is to ensure that the message is picked up correctly.

      9. Run the forum scheduled task:

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

      10. Check your e-mail - you should have received the forum notification e-mail. Open it and check:
        1. The post time matches the day you set as the discussion start time
      11. Update your profile settings to change your mail digets to one of the digest options
      12. Reset the forum post again:

        UPDATE mdl_forum_posts SET mailnow = 1, mailed=0;
        UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast';
        

      13. Run the forum scheduled task - this won't actually send anything but it will queue messages to be sent on the next run...

        # Forum cron only sends messages from before the digest time - put the message back 1 day.
        

        UPDATE mdl_forum_queue SET timemodified = timemodified - 86400;
        UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast';

        # Run cron again - this time it will actually send the messages
        

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

        # Check your e-mail - you should have received the forum notification e-mail. Open it and check:
        ## *The post time matches the day you set as the discussion start time*
        # Update your profile settings to change your mail digets to the other of the digest options
        # Reset the forum post again:
        

        UPDATE mdl_forum_posts SET mailnow = 1, mailed=0;
        UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast';

        # Run the forum scheduled task - this won't actually send anything but it will queue messages to be sent on the next run...
        

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

        # Forum cron only sends messages from before the digest time - put the message back 1 day.
        

        UPDATE mdl_forum_queue SET timemodified = timemodified - 86400;
        UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast';

        # Run cron again - this time it will actually send the messages
        

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

         

      14. Check your e-mail - you should have received the forum notification e-mail. Open it and check:
        1. The post time matches the day you set as the discussion start time
      Show
      Apologies - this issue is an absolute pita to test. Ping me if I got anything wrong. Testing the forum digests is hard . Navigate to Site administration -> Plugins -> Activity modules -> Forum Enabled "Timed posts" Modify your config.php to set: $CFG->maxeditingtime = 1; $CFG->digestmailtime = 9; $CFG->forum_enabletimedposts = 1; Navigate to a course and create a forum within it Create a new discussion and set a "Display start": For master, set the time to a few minutes in the future For older branches, set the time to the previous day Open your database and run a query along the lines of: UPDATE mdl_forum_posts SET modified = modified - 172800, created = created - 172800, mailnow = 1, mailed=0; (This is primarily to ensure that the non-master branches have a time older than the Display start time) Reset the digest last run time: UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast'; Open mod/forum/lib.php in your editor and find where $digesttime is set in the forum_cron() function. Add the following one line later: $digesttime = $digesttime - 60; This is to ensure that the message is picked up correctly. Run the forum scheduled task: php admin/cli/purge_caches.php php admin/tool/task/cli/schedule_task.php --execute="\mod_forum\task\cron_task"; Check your e-mail - you should have received the forum notification e-mail. Open it and check: The post time matches the day you set as the discussion start time Update your profile settings to change your mail digets to one of the digest options Reset the forum post again: UPDATE mdl_forum_posts SET mailnow = 1, mailed=0; UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast'; Run the forum scheduled task - this won't actually send anything but it will queue messages to be sent on the next run... # Forum cron only sends messages from before the digest time - put the message back 1 day. UPDATE mdl_forum_queue SET timemodified = timemodified - 86400; UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast'; # Run cron again - this time it will actually send the messages php admin/cli/purge_caches.php php admin/tool/task/cli/schedule_task.php --execute="\mod_forum\task\cron_task"; # Check your e-mail - you should have received the forum notification e-mail. Open it and check: ## *The post time matches the day you set as the discussion start time* # Update your profile settings to change your mail digets to the other of the digest options # Reset the forum post again: UPDATE mdl_forum_posts SET mailnow = 1, mailed=0; UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast'; # Run the forum scheduled task - this won't actually send anything but it will queue messages to be sent on the next run... php admin/cli/purge_caches.php php admin/tool/task/cli/schedule_task.php --execute="\mod_forum\task\cron_task"; # Forum cron only sends messages from before the digest time - put the message back 1 day. UPDATE mdl_forum_queue SET timemodified = timemodified - 86400; UPDATE mdl_config set value = '0' WHERE name = 'digestmailtimelast'; # Run cron again - this time it will actually send the messages php admin/cli/purge_caches.php php admin/tool/task/cli/schedule_task.php --execute="\mod_forum\task\cron_task";   Check your e-mail - you should have received the forum notification e-mail. Open it and check: The post time matches the day you set as the discussion start time

      We noticed that timed forum posts display the incorrect (or illogical) date a timed post was made available to all users in forum digest emails. Digest emails contain the 'created' date rather than the 'timestart' date that is displayed to the student through the UI

      Steps to replicate

      Note:

      • This test may take 40+ minutes to replicate.
      • We have all emails from our testing environment diverted to one address which makes it easier to test this issue.
      • Set the $CFG->digestmailtimelast time to shortly after the timestart value in step 6.
      • As we are not creating timestart posts days (or weeks) in advance, this may not seem like a huge issue. This will begin to cause serious confusion if the timestart is set weeks in advance, but a digest email displays the postmodified time to the user.
      1. Enabled timed posts ($CFG->forum_enabletimedposts) in site-wide forum settings (if not already enabled)
      2. Ensure the forum cron is running every 5 minutes
      3. Create a site with students enrolled and the students have a variety of all three forum digest types
      4. As a teacher, create a standard forum
      5. As a teacher, force subscription on the forum
      6. As a teacher, create a timed forum post (post 1) with a timestart 20 minutes in the future
      7. As a teacher, create a reply to post 1
      8. As a teacher, create a forum post (post 2) without timestart / timeend enabled and Mail now enabled
      9. Wait for the forum cron to process post 2. Post 2 will be delivered instantly and display the correct forum creation time.
      10. Wait for the next cron run after the timestart value set in post 1 to process. Post 1 will be correctly delivered 20 + minutes past the date it was created (correctly respecting the timestart date), but will display the postmodified time to the user as the post creation time rather than the timestart time.
      11. Wait for the forumdigest cron to process. Post 1 and the reply to post 1 will display the postmodified time to the user despite having a timestart value on the discussion. Post 2 will display the postmodified time correctly.

            dobedobedoh Andrew Lyons
            gregor89 Greg Faller
            Ryan Wyllie Ryan Wyllie
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Simey Lameze Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

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