Moodle
  1. Moodle
  2. MDL-39207

Generate badge assertions using user's backpack email if it is set

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      Might be difficult to test as it requires test server to be accessible from the Internet and an account in Mozilla Backpack.

      1. Use a user account that has an issued badge already, or create a badge and issue it to a user.
      2. Login as this user.
      3. Set up a backpack connection with an email used in Mozilla Backpack but different than local Moodle email.
      4. Try to push badges to the backpack directly.
      5. Badge should be successfully added to the backpack.

      Show
      Might be difficult to test as it requires test server to be accessible from the Internet and an account in Mozilla Backpack. 1. Use a user account that has an issued badge already, or create a badge and issue it to a user. 2. Login as this user. 3. Set up a backpack connection with an email used in Mozilla Backpack but different than local Moodle email. 4. Try to push badges to the backpack directly. 5. Badge should be successfully added to the backpack.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-39207_master

      Description

      When badge assertion is generated, we should check if user has a backpack set up and use their backpack email instead of system email. I think this is what users would expect from the system when they have backpack set up.

        Gliffy Diagrams

          Activity

          Hide
          Dan Poltawski added a comment -

          Sending straight for integration, as seems best to get in before freeze.

          Show
          Dan Poltawski added a comment - Sending straight for integration, as seems best to get in before freeze.
          Hide
          Dan Poltawski added a comment -

          Integrated to master - thanks Yuliya.

          Going to see if there are some QA tests to reset based on this too.

          Show
          Dan Poltawski added a comment - Integrated to master - thanks Yuliya. Going to see if there are some QA tests to reset based on this too.
          Hide
          Dan Poltawski added a comment -

          Reset MDLQA-5714

          Show
          Dan Poltawski added a comment - Reset MDLQA-5714
          Hide
          Rossiani Wijaya added a comment -

          Testing this with QA site.

          Step #3 produces the following warnings:

          Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135
           
          Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136
           
          Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135
           
          Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136
          

          And saving the backpack setting produces:

           
          Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135
           
          Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136
           
          Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135
           
          Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136
           
          Notice: Undefined property: stdClass::$group in /html/badges/mybackpack.php on line 81
           
          Warning: array_filter() expects parameter 1 to be array, null given in /html/badges/mybackpack.php on line 81
           
          Warning: Invalid argument supplied for foreach() in /html/badges/mybackpack.php on line 94
          

          Apart from the above warning messages, the badge is successfully added to backpack.

          Yuliya, could you provide some feedback regarding the above warnings?

          Thanks

          Show
          Rossiani Wijaya added a comment - Testing this with QA site. Step #3 produces the following warnings: Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135   Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136   Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135   Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136 And saving the backpack setting produces:   Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135   Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136   Warning: constant() [function.constant]: Couldn't find constant CURLOPT_CONNECTTIMEOUT_MS in /html/lib/filelib.php on line 3135   Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /html/lib/filelib.php on line 3136   Notice: Undefined property: stdClass::$group in /html/badges/mybackpack.php on line 81   Warning: array_filter() expects parameter 1 to be array, null given in /html/badges/mybackpack.php on line 81   Warning: Invalid argument supplied for foreach() in /html/badges/mybackpack.php on line 94 Apart from the above warning messages, the badge is successfully added to backpack. Yuliya, could you provide some feedback regarding the above warnings? Thanks
          Hide
          Dan Poltawski added a comment -

          Failing this, even though its strictly not related to this test.

          line 67 of badges/lib/backpacklib.php

          Show
          Dan Poltawski added a comment - Failing this, even though its strictly not related to this test. line 67 of badges/lib/backpacklib.php
          Show
          Dan Poltawski added a comment - I've pushed a fix for this: http://git.moodle.org/gw?p=integration.git;a=commitdiff;h=dd4a197e0f0da283ef40cc08b0808e586fcf7294
          Hide
          Dan Poltawski added a comment -

          Hi Rosie,

          I (think) i've forced the qa site to be updated, could you test this again?

          Show
          Dan Poltawski added a comment - Hi Rosie, I (think) i've forced the qa site to be updated, could you test this again?
          Hide
          Rossiani Wijaya added a comment -

          Sure Dan. Will re-test this issue in 5 mins. (Waiting for qa site to finish the hourly maintenance.

          Show
          Rossiani Wijaya added a comment - Sure Dan. Will re-test this issue in 5 mins. (Waiting for qa site to finish the hourly maintenance.
          Hide
          Rossiani Wijaya added a comment -

          Hi Dan,

          Your patch fixed the CURL warning.

          However the following warning still occurs:

          Notice: Undefined property: stdClass::$group in /html/badges/mybackpack.php on line 81
           
          Warning: array_filter() expects parameter 1 to be array, null given in /html/badges/mybackpack.php on line 81
           
          Warning: Invalid argument supplied for foreach() in /html/badges/mybackpack.php on line 94
          

          I'm re-failing this issue for the above notices. Sorry.

          Show
          Rossiani Wijaya added a comment - Hi Dan, Your patch fixed the CURL warning. However the following warning still occurs: Notice: Undefined property: stdClass::$group in /html/badges/mybackpack.php on line 81   Warning: array_filter() expects parameter 1 to be array, null given in /html/badges/mybackpack.php on line 81   Warning: Invalid argument supplied for foreach() in /html/badges/mybackpack.php on line 94 I'm re-failing this issue for the above notices. Sorry.
          Hide
          Yuliya Bozhko added a comment -

          According to Php Docs CURLOPT_CONNECTTIMEOUT_MS was added in cURL 7.16.2, and is available since PHP 5.2.3. Your version of curl might be older, that's the only explanation I could think of...

          I can't reproduce your latest issue. However, it is not related to the patch at all. Can you please submit a separate bug, and I will fix it? Thanks!

          Show
          Yuliya Bozhko added a comment - According to Php Docs CURLOPT_CONNECTTIMEOUT_MS was added in cURL 7.16.2, and is available since PHP 5.2.3. Your version of curl might be older, that's the only explanation I could think of... I can't reproduce your latest issue. However, it is not related to the patch at all. Can you please submit a separate bug, and I will fix it? Thanks!
          Hide
          Damyon Wiese added a comment -

          Sending this back to testing

          Show
          Damyon Wiese added a comment - Sending this back to testing
          Hide
          Rossiani Wijaya added a comment -

          Hi Yuliya,

          After re-testing this issue again, I think it should be fixed within this because it is part of setting up an email connection to backpack.

          Steps to reproduce in QA site:

          1. Login as student
          2. In Admin > my profile settings > badges > backpack settings, disconnect backpack connection if it is currently connecting.
          3. Enter the email address for backpack and select connect
          4. Select save changes on backpack settings page. It displays the above errors.
          Show
          Rossiani Wijaya added a comment - Hi Yuliya, After re-testing this issue again, I think it should be fixed within this because it is part of setting up an email connection to backpack. Steps to reproduce in QA site: Login as student In Admin > my profile settings > badges > backpack settings, disconnect backpack connection if it is currently connecting. Enter the email address for backpack and select connect Select save changes on backpack settings page. It displays the above errors.
          Hide
          Yuliya Bozhko added a comment -

          Can you please give me more details? Database, browser, etc. Are you behind firewall? Using proxy? Do you have an account in backpack? Do you public collections? Do you have any badges in backpack?

          I seriously can't reproduce it and don't understand why it would be happening... :-/ The only error I was able to get if when there is no internet connection at all, but it's an absolutely different one.

          Show
          Yuliya Bozhko added a comment - Can you please give me more details? Database, browser, etc. Are you behind firewall? Using proxy? Do you have an account in backpack? Do you public collections? Do you have any badges in backpack? I seriously can't reproduce it and don't understand why it would be happening... :-/ The only error I was able to get if when there is no internet connection at all, but it's an absolutely different one.
          Hide
          Rossiani Wijaya added a comment -

          You could try this on http://qa.moodle.net and follow the steps I wrote above.

          I'm using Firefox as browser to test this.

          Show
          Rossiani Wijaya added a comment - You could try this on http://qa.moodle.net and follow the steps I wrote above. I'm using Firefox as browser to test this.
          Hide
          Yuliya Bozhko added a comment -

          Got it! Thanks! Github is down for some reason. I will push the change when it is back up

          Show
          Yuliya Bozhko added a comment - Got it! Thanks! Github is down for some reason. I will push the change when it is back up
          Hide
          Yuliya Bozhko added a comment -

          Fix is already up, I updated the tracker with URL to a new commit.

          Show
          Yuliya Bozhko added a comment - Fix is already up, I updated the tracker with URL to a new commit.
          Hide
          Rossiani Wijaya added a comment -

          Failing this issue so the new patch gets integrated.

          Show
          Rossiani Wijaya added a comment - Failing this issue so the new patch gets integrated.
          Hide
          Damyon Wiese added a comment -

          Thanks Yuliya,

          I could reproduce this error locally (on my non-public moodle) and the fix addressed the problem.

          I have integrated this fix now and will reset this issue.

          One thing to note is that when you fixed this you amended your original commit - once patches are integrated it is easier for us integrators if you add any fixes as a new commit on top of your original branch.

          Show
          Damyon Wiese added a comment - Thanks Yuliya, I could reproduce this error locally (on my non-public moodle) and the fix addressed the problem. I have integrated this fix now and will reset this issue. One thing to note is that when you fixed this you amended your original commit - once patches are integrated it is easier for us integrators if you add any fixes as a new commit on top of your original branch.
          Hide
          Rossiani Wijaya added a comment -

          Thanks Yuliya and Damyon,

          This is working great now.

          Test passed.

          Show
          Rossiani Wijaya added a comment - Thanks Yuliya and Damyon, This is working great now. Test passed.
          Hide
          Dan Poltawski added a comment -

          Thanks! You're changes are now spread to the world through this git and our source control repositories.

          No time to rest though, we've got days to make 2.5 the best yet!

          ciao

          Show
          Dan Poltawski added a comment - Thanks! You're changes are now spread to the world through this git and our source control repositories. No time to rest though, we've got days to make 2.5 the best yet! ciao
          Hide
          Mary Cooch added a comment -

          Removing docs_required as I think the current docs are clear enough but if anyone disagrees, please let me know here or feel free to add to http://docs.moodle.org/25/en/Badges

          Show
          Mary Cooch added a comment - Removing docs_required as I think the current docs are clear enough but if anyone disagrees, please let me know here or feel free to add to http://docs.moodle.org/25/en/Badges

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: