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

Cannot comment a question when system context id is not 1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.0.5
    • 4.0.2, 4.0.4
    • Questions

      For whatever reason (most probably a replication configuration in db where autoincrement columns have an offset),  a system context id can have other values than 1.

      The "comment" question bank plugin, in some situations, uses a hardcoded value of 1 to contextid, causing Moodle 4 to fail when trying to comment questions or when trying to previsualize them when contextid 1 does not exists.

      Here are the places where i've detected the thing:

       

      https://github.com/moodle/moodle/blob/master/question/bank/comment/lib.php#L87

       

      https://github.com/moodle/moodle/blob/master/question/bank/comment/classes/comment_count_column.php#L62

       

      https://github.com/moodle/moodle/blob/master/question/bank/comment/amd/src/comment.js#L103

       

      I don't know if 1 is intended to be something else than the system context id... so i want to ask you before substituting this with a context_system::instance()->id

      Thanks in advance.

            timhunt Tim Hunt
            jsegarra Juan Segarra Montesinos
            Paul Holden Paul Holden
            Jun Pataleta Jun Pataleta
            CiBoT CiBoT
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 40 minutes
                1h 40m

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