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

Forum render doesn't handle deleted user without context

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 3.7
    • Component/s: Forum
    • Labels:
    • Testing Instructions:
      Hide
      1. This test requires access to the database
      2. Log in as admin
      3. Create a site with 2 users
      4. Create a course and enrol the 2 users
      5. Create a forum activity in the course
      6. Create 2 discussion in the course as the admin user
      7. Log in as user 1
      8. View the forum and add a reply to one of the admin discussions
      9. Create a separate discussion in the forum
      10. Log in as user 2
      11. View the forum and add a reply to the other admin discussion (the one that user 1 didn't reply in)
      12. Create a separate discussion in the forum
      13. There should now be 4 discussions in the forum
        • Created by admin with user 1 posting in it
        • Created by admin with user 2 postint in it
        • Created by user 1
        • Created by user 2
      14. Log in as admin
      15. Go to site administration and delete both user 1 and user 2
      16. Log in to the database
      17. Delete the record for user 2 from the context table
        • You can find it by doing SELECT * FROM "<context_table>" WHERE contextlevel = 30 AND instanceid = <user_2_id>
      18. View the forum
      19. CONFIRM the list of discussions show even though both users are deleted and user 2 has had their context deleted from the DB
      20. View each of the discussions
      21. CONFIRM that each discussion is rendered
      Show
      This test requires access to the database Log in as admin Create a site with 2 users Create a course and enrol the 2 users Create a forum activity in the course Create 2 discussion in the course as the admin user Log in as user 1 View the forum and add a reply to one of the admin discussions Create a separate discussion in the forum Log in as user 2 View the forum and add a reply to the other admin discussion (the one that user 1 didn't reply in) Create a separate discussion in the forum There should now be 4 discussions in the forum Created by admin with user 1 posting in it Created by admin with user 2 postint in it Created by user 1 Created by user 2 Log in as admin Go to site administration and delete both user 1 and user 2 Log in to the database Delete the record for user 2 from the context table You can find it by doing SELECT * FROM "<context_table>" WHERE contextlevel = 30 AND instanceid = <user_2_id> View the forum CONFIRM the list of discussions show even though both users are deleted and user 2 has had their context deleted from the DB View each of the discussions CONFIRM that each discussion is rendered
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Epic Link:
    • Pull Master Branch:
      MDL-65505-master

      Description

      In older versions of Moodle we used to delete the user's context when the user was deleted but left the user record around.

      The changes made in MDL-65394 introduced the assumption that all forum post authors would have a context which isn't true in the above case.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 30 minutes
                  2h 30m