Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-778 META: Migrate to Ionic
  3. MOBILE-1052

Implement "Mock site": be able to use any stored site

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Others
    • Labels:
    • Testing Instructions:
      Hide

      This patch changes the implementation of $mmSite and $mmSitesManager, so it's important to check that the app is not broken after this patch. Some things to check that work fine:

      • Login actions: add site, delete site, login, logout, restore session, reconnect (token expired).
      • In-app actions: see courses, participants, grades, files, etc.

      Right now there's no code to use "mock site" yet, so you'd have to change the code to be able to test it. E.g. you can paste the following code to any .run function and check that you can see in the console the courses of each site stored. You can also use it to check that using .read/.write on an expired site that's not the current site doesn't redirect to reconnect page.

      $mmSitesManager.getSites().then(function(sites) {
          angular.forEach(sites, function(sitedata) {
              $mmSitesManager.getSite(sitedata.id).then(function(site) {
                  site.read('core_enrol_get_users_courses', {userid: site.infos.userid}).then(function(courses) {
                      console.log('****** COURSES FROM SITE ' + site.id + ' ******');
                      console.log(courses);
                  });
              });
          });
      });
      

      Make sure to also test with a app freshly installed, free of any data

      Show
      This patch changes the implementation of $mmSite and $mmSitesManager, so it's important to check that the app is not broken after this patch. Some things to check that work fine: Login actions: add site, delete site, login, logout, restore session, reconnect (token expired). In-app actions: see courses, participants, grades, files, etc. Right now there's no code to use "mock site" yet, so you'd have to change the code to be able to test it. E.g. you can paste the following code to any .run function and check that you can see in the console the courses of each site stored. You can also use it to check that using .read/.write on an expired site that's not the current site doesn't redirect to reconnect page. $mmSitesManager.getSites().then(function(sites) { angular.forEach(sites, function(sitedata) { $mmSitesManager.getSite(sitedata.id).then(function(site) { site.read('core_enrol_get_users_courses', {userid: site.infos.userid}).then(function(courses) { console.log('****** COURSES FROM SITE ' + site.id + ' ******'); console.log(courses); }); }); }); }); Make sure to also test with a app freshly installed, free of any data
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Pull Master Branch:

      Description

      Some issues are blocked by a need of having what we call "mock site": being able to retrieve a certain site of the ones stored and use that one like we do with the current site, but without changing the current site.

      For example, we need that to upload a file to any site on iOS, or to get the events for any site on calendar events.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dpalou Dani Palou
              Reporter:
              dpalou Dani Palou
              Peer reviewer:
              Frédéric Massart Frédéric Massart
              Integrator:
              Juan Leyva Juan Leyva
              Tester:
              Juan Leyva Juan Leyva
              Participants:
              Component watchers:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                31/Jul/15