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

Integrate message_airnotifier in core

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide

      Testing this issue is difficult, if you have any doubt/problem during testing please contact me.

      Notice also that during testing Andrew Nicols has found some bugs in the forced settings functionality, I've been investigating and I've found:

      • Changes in Plugins / ▶ Message outputs / ▶ Default message outputs settings are not reflected in the form
      • The UI for configuring Messages notifications is broken when displaying forced settigns
      • Default message settings are stored in config table and it seems that the cache is not refreshed on changes in the first form mentioned, and sometimes the cache is refreshed but the change is not present in the database

      These bugs may impact during testing the Web Services, so I suggest to initially not test forced settings. (In the last commit we check anyway this settings so the plugin should support it when start working correctly)

      • Install the plugin in a Moodle registered test site (in order to get an accesskey from Airnotifier, the site must be registered) If you can't register the site check please the last comment (only visible by developers) where you'll find a valid access key
      • If you already have an access key go to the next step. Once installed, go to Site administration /Plugins /Message outputs /Mobile Notifications and click in Request access key, if you site is registered you will receive a valid key (alpha numeric token)
      • You should try also to request an access key for a non-registered Moodle site (it should fail and give you an error)
      • Open the Mobile App (it requires iOs: iPhone or iPad). Connect to your site, it should detect that you have enabled Push notifications. If not, tap on the "reload" icon at the top of the orange left menu. You can also delete all the caches in the Mobile app Settings / Development / Purge caches
      • (Mobile app) go to notifications (top left main orange menu in the app), if the user hasn't configured yet their Messaging settings he will receive a message indicating that he must configure their profile message settings
      • Go to you Moodle installation, configure your Settings -> Messaging for receiving Mobile notifications for direct messages
      • Send a private message to the user configured in the Mobile app to check that he receive a Push notification from the server with the message
      • Add new settings in your messaging configurations in order to receive assignment, forum, etc.. notifications
      • Test that you receive the notifications from Moodle, like forum subscription posts, notifications when you are teacher and a new assignment has been submitted etc..
      • Edit the user authenticated role as system level, disable the message/airnotifier:managedevice capability. Go to the user Settings -> Messaging, a message saying that you don't have permissions to manage devices should be displayed

      For testing the WebServices:

      Enable Web Services in Advanced features
      Enable Web services for mobile devices in Plugins / WebServices / Services
      Use this client: https://gist.github.com/jleyva/9954463
      The required curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php

      You need a token related to a service, for get a token you need to create a new service, add a shortname to that service, and add the message_airnotifier_is_system_configured and message_airnotifier_are_notification_preferences_configured functions to that service

      Create Token:
      Click on Site administration ► Plugins ► Web services ► Manage tokens
      Click add, select user and service

      0 Edit the client file for replacing your token and moodle url
      1 Go to Site administration / ▶ Plugins / ▶ Message outputs / ▶ Mobile notifications, delete the contents of the Airnotifier access key field
      2 Run the client in a browser, it should return 0
      3 Add a Airnotifier access key (a random string for testing is enough)
      4 Run the client, it should return 1
      5 Disable the plugin (plugins / message outputs)
      6 Run the client, it should return 0
      7 Enable the plugin again, delete the contents of any of the other fields (url, port, app name)
      8 Run the client, it should return 0

      Now we are going to test the message_airnotifier_are_notification_preferences_configured function,
      download this client: https://gist.github.com/jleyva/9954692

      0 Edit the client file for replacing your token and moodle url
      1 Edit the client, replace the userids array with the user id you used for creating the token
      2 Go to My profile settings / ▶ Messaging , uncheck all the checkboxes in the Mobile notifications preferences column
      3 Run the client
      4 It should return an object with no warnings and configured = 0
      5 Add a couple of existing user ids in the client file (userids variable)
      6 Run the client, it should return an object with two warnings "You don't have permissions for view user X preferences"
      7 Go to My profile settings / ▶ Messaging, check one or two of the checkboxes in the Mobile notification column
      8 Run the client, t should return an object with two warnings "You don't have permissions for view user X preferences" and configured = 1 for the current user id

      Show
      Testing this issue is difficult, if you have any doubt/problem during testing please contact me. Notice also that during testing Andrew Nicols has found some bugs in the forced settings functionality, I've been investigating and I've found: Changes in Plugins / ▶ Message outputs / ▶ Default message outputs settings are not reflected in the form The UI for configuring Messages notifications is broken when displaying forced settigns Default message settings are stored in config table and it seems that the cache is not refreshed on changes in the first form mentioned, and sometimes the cache is refreshed but the change is not present in the database These bugs may impact during testing the Web Services, so I suggest to initially not test forced settings. (In the last commit we check anyway this settings so the plugin should support it when start working correctly) Install the plugin in a Moodle registered test site (in order to get an accesskey from Airnotifier, the site must be registered) If you can't register the site check please the last comment (only visible by developers) where you'll find a valid access key If you already have an access key go to the next step. Once installed, go to Site administration /Plugins /Message outputs /Mobile Notifications and click in Request access key, if you site is registered you will receive a valid key (alpha numeric token) You should try also to request an access key for a non-registered Moodle site (it should fail and give you an error) Open the Mobile App (it requires iOs: iPhone or iPad). Connect to your site, it should detect that you have enabled Push notifications. If not, tap on the "reload" icon at the top of the orange left menu. You can also delete all the caches in the Mobile app Settings / Development / Purge caches (Mobile app) go to notifications (top left main orange menu in the app), if the user hasn't configured yet their Messaging settings he will receive a message indicating that he must configure their profile message settings Go to you Moodle installation, configure your Settings -> Messaging for receiving Mobile notifications for direct messages Send a private message to the user configured in the Mobile app to check that he receive a Push notification from the server with the message Add new settings in your messaging configurations in order to receive assignment, forum, etc.. notifications Test that you receive the notifications from Moodle, like forum subscription posts, notifications when you are teacher and a new assignment has been submitted etc.. Edit the user authenticated role as system level, disable the message/airnotifier:managedevice capability. Go to the user Settings -> Messaging, a message saying that you don't have permissions to manage devices should be displayed For testing the WebServices: Enable Web Services in Advanced features Enable Web services for mobile devices in Plugins / WebServices / Services Use this client: https://gist.github.com/jleyva/9954463 The required curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php You need a token related to a service, for get a token you need to create a new service, add a shortname to that service, and add the message_airnotifier_is_system_configured and message_airnotifier_are_notification_preferences_configured functions to that service Create Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service 0 Edit the client file for replacing your token and moodle url 1 Go to Site administration / ▶ Plugins / ▶ Message outputs / ▶ Mobile notifications, delete the contents of the Airnotifier access key field 2 Run the client in a browser, it should return 0 3 Add a Airnotifier access key (a random string for testing is enough) 4 Run the client, it should return 1 5 Disable the plugin (plugins / message outputs) 6 Run the client, it should return 0 7 Enable the plugin again, delete the contents of any of the other fields (url, port, app name) 8 Run the client, it should return 0 Now we are going to test the message_airnotifier_are_notification_preferences_configured function, download this client: https://gist.github.com/jleyva/9954692 0 Edit the client file for replacing your token and moodle url 1 Edit the client, replace the userids array with the user id you used for creating the token 2 Go to My profile settings / ▶ Messaging , uncheck all the checkboxes in the Mobile notifications preferences column 3 Run the client 4 It should return an object with no warnings and configured = 0 5 Add a couple of existing user ids in the client file (userids variable) 6 Run the client, it should return an object with two warnings "You don't have permissions for view user X preferences" 7 Go to My profile settings / ▶ Messaging, check one or two of the checkboxes in the Mobile notification column 8 Run the client, t should return an object with two warnings "You don't have permissions for view user X preferences" and configured = 1 for the current user id
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      The Push infrastructure is almost done, we need to integrate the airnotifier message pluging into Moodle 2.7 before code freeze

      I need some advice about how to create unit tests for this type of plugin

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14