Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-4089

Forum prefetch never finishes when downloading a single forum from Course downloads page

    XMLWordPrintable

Details

    • Bug
    • Status: Tested
    • Critical
    • Resolution: Unresolved
    • 4.0.1
    • None
    • Forum add-on
    • Hide

      This issue only needs to be tested in 1 device.

      1. Login in our master site.
      2. Go to MM Dev Testing Course and go to Course downloads (top-right icon).
      3. Go to the Forum section and click the download icon next to "Standard forum (foro) (with posts made...". Check that the download finishes successfully.
      4. Go back to the course page.
      5. Open the forum you downloaded.
      6. Add a new reply to a post, or add a new discussion. No need to add attachments, just any text.
      7. Go back to course page and perform a PTR.
      8. Open Course downloads again. Check that now you see the cloud-refresh icon next to the forum.
      9. Click this refresh icon. Check that the download finishes successfully.
      Show
      This issue only needs to be tested in 1 device. Login in our master site. Go to MM Dev Testing Course and go to Course downloads (top-right icon). Go to the Forum section and click the download icon next to "Standard forum (foro) (with posts made...". Check that the download finishes successfully. Go back to the course page. Open the forum you downloaded. Add a new reply to a post, or add a new discussion. No need to add attachments, just any text. Go back to course page and perform a PTR. Open Course downloads again. Check that now you see the cloud-refresh icon next to the forum. Click this refresh icon. Check that the download finishes successfully.
    • MOODLE_400_STABLE
    • Moodle App 4.0.2

    Description

      In the forum prefetch, we only download the first 2 pages of discussions and all their posts. However, when the prefetch starts we call invalidateContent, and this function is fetching all pages of discussions because it doesn't specify a "numPages".

      IMO the invalidateContent function should use ONLY_CACHE instead of PREFER_CACHE to get the stored pages, and stop obtaining more once a request fails.

      EDIT: While investigating the issue I found 3 different bugs:

      1. The "recursive" function in getDiscussionsInPages doesn't pass the page to the getDiscussions, it always fetches the page 0. This causes an infinite loop when downloading a single forum from the Course downloads page.
      2. As said above, we should use ONLY_CACHE instead of PREFER_CACHE to get only the "downloaded" pages.
      3. In the Course downloads page, the template calls prefetchModule(module, section), but the function is defined as prefetchModule(module, refresh = false). So it's always considered as refresh=true but that wasn't intended.

      Attachments

        Activity

          People

            dpalou Dani Palou
            dpalou Dani Palou
            Pau Ferrer Pau Ferrer
            Isabel Renedo Rouco Isabel Renedo Rouco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: