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

Submission comments get the same id and don't load

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.9
    • Fix Version/s: None
    • Component/s: Comments
    • Affected Branches:
      MOODLE_29_STABLE

      Description

      We have a problem where the drop down to display Submission comments in the gradebook won't work for one or more random assignment: it just bring the browser at the page top instead of displaying the ajax loader. Refreshing the page change which assignment having the problem.

      I found out that the problematic comments get the same id as its predecessor, so based on Damyon comment in https://tracker.moodle.org/browse/MDL-40096, I edited \comment\lib.php and changed the call from uniqid() to html_writer:random_id() in the constructor. So far so good, it seem to have resolved the problem.

          public function __construct(stdClass $options) {
              $this->viewcap = false;
              $this->postcap = false;
       
              // setup client_id
              if (!empty($options->client_id)) {
                  $this->cid = $options->client_id;
              } else {
                  $this->cid = html_writer::random_id(); //uniqid(); <-- change here
              }
      [...]
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jackdaniels JD
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: