Moodle
  1. Moodle
  2. MDL-39923

Make badge notifications use internal Moodle messaging

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      For testing you need admin user, several standard student users with email addresses that you can check, and a badge with manual award by role set up as criteria (so that it is possible to quickly award a badge to a user).

      Part 1.

      1. Go to /admin/settings.php?section=messagesettingemail admin settings and make sure that "Allow attachments" is set to NO.
      2. Go to badge message settings under /badges/edit.php?id=XXX&action=message where XXX is a badge ID. Make sure that you can't change "Attach badge to message" setting because it depends on attachments being enabled.
      3. Award a badge to any user. Check user email. There should be a message with subject specified earlier in a badge message settings (default one is "Congratulations! You just earned a badge!"). Make sure there is no image file attached to the email.

      Part 2.

      1. Now, enable "Allow attachments" in admin settings.
      2. Make sure that you can change checkbox "Attach badge to message" in badge message settings. Leave it checked.
      3. Award a badge to another user. Check this user email. There should be a badge message with subject specified earlier in a badge message settings (default one is "Congratulations! You just earned a badge!"). Make sure there is an image file attached to the email. This should be a badge that a user just earned.

      Part 3.

      1. Open the badge's messaging settings
      2. Disable attaching the badge to the message
      3. Award a user the badge
      4. Check that it was not included.
      Show
      For testing you need admin user, several standard student users with email addresses that you can check, and a badge with manual award by role set up as criteria (so that it is possible to quickly award a badge to a user). Part 1. Go to /admin/settings.php?section=messagesettingemail admin settings and make sure that "Allow attachments" is set to NO. Go to badge message settings under /badges/edit.php?id=XXX&action=message where XXX is a badge ID. Make sure that you can't change "Attach badge to message" setting because it depends on attachments being enabled. Award a badge to any user. Check user email. There should be a message with subject specified earlier in a badge message settings (default one is "Congratulations! You just earned a badge!"). Make sure there is no image file attached to the email. Part 2. Now, enable "Allow attachments" in admin settings. Make sure that you can change checkbox "Attach badge to message" in badge message settings. Leave it checked. Award a badge to another user. Check this user email. There should be a badge message with subject specified earlier in a badge message settings (default one is "Congratulations! You just earned a badge!"). Make sure there is an image file attached to the email. This should be a badge that a user just earned. Part 3. Open the badge's messaging settings Disable attaching the badge to the message Award a user the badge Check that it was not included.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-39923_master

      Description

      As discussed in the thread https://moodle.org/mod/forum/discuss.php?d=229477#p996621, Badges should be awarded in a more 'triumphant' way than with an email, such as a pop-up. Currently the user is unaware (s)he has been awarded a badge unless they check either the 'my badges' block or their emails. It would be nice if they were told immediately, preferably with some nice graphics too to give them an immediate sense of achievement.

      Yuliya: This is happening because badges notifications are not going through standard Moodle messaging. Since now it is possible to send attachments using Moodle message libraries, I will update the code to make sure that badges are using them too.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Helen Foster added a comment -

            Chris, thanks for your suggested improvement. Just to clarify, are you suggesting that, in addition to email and the my badges block, there should be a popup notification for a new badge? Are there any other notification methods that we should consider?

            Show
            Helen Foster added a comment - Chris, thanks for your suggested improvement. Just to clarify, are you suggesting that, in addition to email and the my badges block, there should be a popup notification for a new badge? Are there any other notification methods that we should consider?
            Hide
            Richard Bakos added a comment - - edited

            Traditional popups not initiated by the user could be problematic for those with popup blockers and certain mobile devices. For instance, take a SCORM activity set to open in a new window. If you have the settings of the SCORM activity to skip content structure page always for the student, bypassing the "enter" button and the student has the popup blocker on, the SCORM activity will not open. Same could be the case in using a popup for something like this as well... I think some sort of modal should be used or other method that will prevent this behavior.

            Show
            Richard Bakos added a comment - - edited Traditional popups not initiated by the user could be problematic for those with popup blockers and certain mobile devices. For instance, take a SCORM activity set to open in a new window. If you have the settings of the SCORM activity to skip content structure page always for the student, bypassing the "enter" button and the student has the popup blocker on, the SCORM activity will not open. Same could be the case in using a popup for something like this as well... I think some sort of modal should be used or other method that will prevent this behavior.
            Hide
            Nneko Branche added a comment -

            Helen and Richard,

            What we could consider is displaying the badge as a notification message in a banner that slides down at the top of the page. We could then make it fade out and disappear in a few seconds. An implementation of this nature would avoid the problematic nature of a popup window etc.

            If done correctly it wouldn't be jarring and could be display instantly (if the badge is awarded based on a automatic criteria) or on the next user login.

            Show
            Nneko Branche added a comment - Helen and Richard, What we could consider is displaying the badge as a notification message in a banner that slides down at the top of the page. We could then make it fade out and disappear in a few seconds. An implementation of this nature would avoid the problematic nature of a popup window etc. If done correctly it wouldn't be jarring and could be display instantly (if the badge is awarded based on a automatic criteria) or on the next user login.
            Hide
            Chris added a comment -

            Nneko, That's precisely what I had in mind. In just the same way as the 'message received' pop up happens (this might only be in the decaf theme, I'm not sure).

            Show
            Chris added a comment - Nneko, That's precisely what I had in mind. In just the same way as the 'message received' pop up happens (this might only be in the decaf theme, I'm not sure).
            Hide
            Yoni Lerner added a comment -

            I agree, this issue has to addressed as it's very useful.
            What about using badge as a resource?
            For example, I could use conditions with it, so it'll show on the topic when the user finishes the quiz.

            Show
            Yoni Lerner added a comment - I agree, this issue has to addressed as it's very useful. What about using badge as a resource? For example, I could use conditions with it, so it'll show on the topic when the user finishes the quiz.
            Hide
            Doug Moody added a comment -

            A great reason to do this is that not all students have an email address. What about those students? If they can't receive Email, then they can't receive badges notifications! Plus, if notifications come through messaging popups (for example) then it is instant gratification, which is usually better than delayed gratification.

            Show
            Doug Moody added a comment - A great reason to do this is that not all students have an email address. What about those students? If they can't receive Email, then they can't receive badges notifications! Plus, if notifications come through messaging popups (for example) then it is instant gratification, which is usually better than delayed gratification.
            Hide
            Yuliya Bozhko added a comment -

            Hi Doug,

            Just a side note. Badges are awarded to an email address, not a username. If your students don't have email addresses, they won't be able to export badges and store them into any kind of external backpack.

            Show
            Yuliya Bozhko added a comment - Hi Doug, Just a side note. Badges are awarded to an email address, not a username. If your students don't have email addresses, they won't be able to export badges and store them into any kind of external backpack.
            Hide
            Randy Thornton added a comment -

            Just like add a comment that this absolutely should go through the standard Messaging Outputs as a pop up notification and we should not reinvent the wheel. The development, administrative, user profile, and theme issues for outputs are well known already and documented.

            Show
            Randy Thornton added a comment - Just like add a comment that this absolutely should go through the standard Messaging Outputs as a pop up notification and we should not reinvent the wheel. The development, administrative, user profile, and theme issues for outputs are well known already and documented.
            Hide
            Simon Coggins added a comment -

            The problem with using messages is they don't currently support attachments, so there is no way to send the badge with the message.

            We could of course send a link to the badge page where the user could download it from, we just can't attach it directly to the message.

            Simon

            Show
            Simon Coggins added a comment - The problem with using messages is they don't currently support attachments, so there is no way to send the badge with the message. We could of course send a link to the badge page where the user could download it from, we just can't attach it directly to the message. Simon
            Hide
            Simon Coggins added a comment -

            I'm not saying that we shouldn't do this, by the way - actually I think it's a good idea to switch to using messages as it allow popup notification but also let the user control how they are notified via the normal message settings.

            Show
            Simon Coggins added a comment - I'm not saying that we shouldn't do this, by the way - actually I think it's a good idea to switch to using messages as it allow popup notification but also let the user control how they are notified via the normal message settings.
            Hide
            Randy Thornton added a comment -

            Simon,
            That's a good point about the attachment of the badge in email. Is this a fully baked badge? If so, how does that interact with having a backpack attached and what the badge recipient is?

            I think another key factor for using Messaging ouptuts is there is at least some central administrative control (not optimal, but some). And I see a number of large companies and institutions planning on moving to badges who will want as much central control and standardization around badges as around grades.

            Show
            Randy Thornton added a comment - Simon, That's a good point about the attachment of the badge in email. Is this a fully baked badge? If so, how does that interact with having a backpack attached and what the badge recipient is? I think another key factor for using Messaging ouptuts is there is at least some central administrative control (not optimal, but some). And I see a number of large companies and institutions planning on moving to badges who will want as much central control and standardization around badges as around grades.
            Hide
            Yuliya Bozhko added a comment -

            Hi Randy,

            Attached image in the email sent to a user is a fully baked badge. It can be downloaded from an email and uploaded to Mozilla Backpack. For usability requirements, we had to pick email_to_user() for sending badges instead of internal messaging methods.

            Essentially, baking a badge is embedding assertion URL into an image. It doesn't have any information about the recipient or backpack. When you upload this email to your backpack, backpack service reads the assertion URL, goes to that URL, and tries to retrieve badge information from the issuer web site (this is called hosted assertion). Depending on whether user has a backpack connected or not, assertion might return different recipient emails. For example, your Moodle email is me@mymoodle.com, but your backpack email is me@gmail.com. When you upload a badge to a backpack, assertion will return your backpack email if it is connected, otherwise it will return Moodle email. If emails match, it doesn't really matter.

            Regarding Messaging, it is a complicated decision at the moment. While we would really want to switch to internal messaging system, it will require quite a bit of work. We will probably need to add badge messaging output to provide users with more global control over badge images. We'll need to decide what to do with image attachments (we will probably have to let them go as internal messaging doesn't support attachments). It would be nice to have a badge image displayed in instant notifications which I don't think is possible either... These are just thoughts off the top of my head, and there are probably more things to consider

            If you have any more suggestions/ideas, please don't hesitate to share them with us. I will try to have a look at this issue as soon as possible when I get a bit more time.

            Thanks!

            Yuliya

            Show
            Yuliya Bozhko added a comment - Hi Randy, Attached image in the email sent to a user is a fully baked badge. It can be downloaded from an email and uploaded to Mozilla Backpack. For usability requirements, we had to pick email_to_user() for sending badges instead of internal messaging methods. Essentially, baking a badge is embedding assertion URL into an image. It doesn't have any information about the recipient or backpack. When you upload this email to your backpack, backpack service reads the assertion URL, goes to that URL, and tries to retrieve badge information from the issuer web site (this is called hosted assertion). Depending on whether user has a backpack connected or not, assertion might return different recipient emails. For example, your Moodle email is me@mymoodle.com, but your backpack email is me@gmail.com. When you upload a badge to a backpack, assertion will return your backpack email if it is connected, otherwise it will return Moodle email. If emails match, it doesn't really matter. Regarding Messaging, it is a complicated decision at the moment. While we would really want to switch to internal messaging system, it will require quite a bit of work. We will probably need to add badge messaging output to provide users with more global control over badge images. We'll need to decide what to do with image attachments (we will probably have to let them go as internal messaging doesn't support attachments). It would be nice to have a badge image displayed in instant notifications which I don't think is possible either... These are just thoughts off the top of my head, and there are probably more things to consider If you have any more suggestions/ideas, please don't hesitate to share them with us. I will try to have a look at this issue as soon as possible when I get a bit more time. Thanks! Yuliya
            Hide
            Randy Thornton added a comment -

            Yuliya,

            Thank you: now I get it! It's a hosted assertion. I had assumed that recipient was already baked in. Makes perfect sense now

            I have been plugging using Messaging outputs mainly because 1) it's already there, and 2) it has some administrative control.

            But it sounds like it would be more work for you to do it that way. I was hoping it would be an easy, quick way to get some of these features working, but it sounds as though it is not.

            Maybe, like some of the forum settings, it should be in the user profile. Speaking from the administrator's point of view, while no one loves Messaging outputs, it is better than the old days when each module did its own messaging. Now at least there is an attempt to centralize the control of all messaging for users.

            But Messaging outputs really needs some love: more features, better interface. What badges needs may be beyond what improvements (if any) are planned for it, but if so, there needs to be some ability for an administrator to 1) set the defaults, and 2) also to actively change/update and push out settings too.

            What I am hearing so far from companies doing professional development is they will want corporate control of badges: standardize the images, standardize the criteria, standardize the messaging, and all with full reporting. I'm sure you are hearing this from Totara clients too.

            • Thanks

            Randy

            Show
            Randy Thornton added a comment - Yuliya, Thank you: now I get it! It's a hosted assertion. I had assumed that recipient was already baked in. Makes perfect sense now I have been plugging using Messaging outputs mainly because 1) it's already there, and 2) it has some administrative control. But it sounds like it would be more work for you to do it that way. I was hoping it would be an easy, quick way to get some of these features working, but it sounds as though it is not. Maybe, like some of the forum settings, it should be in the user profile. Speaking from the administrator's point of view, while no one loves Messaging outputs, it is better than the old days when each module did its own messaging. Now at least there is an attempt to centralize the control of all messaging for users. But Messaging outputs really needs some love: more features, better interface. What badges needs may be beyond what improvements (if any) are planned for it, but if so, there needs to be some ability for an administrator to 1) set the defaults, and 2) also to actively change/update and push out settings too. What I am hearing so far from companies doing professional development is they will want corporate control of badges: standardize the images, standardize the criteria, standardize the messaging, and all with full reporting. I'm sure you are hearing this from Totara clients too. Thanks Randy
            Hide
            Yuliya Bozhko added a comment -

            Although this one depends on MDL-41956, would be good if someone could have a look and give me some feedabck

            Thanks!

            Show
            Yuliya Bozhko added a comment - Although this one depends on MDL-41956 , would be good if someone could have a look and give me some feedabck Thanks!
            Hide
            Yuliya Bozhko added a comment -

            Need to adjust this fix since messaging now allows attachments.

            Show
            Yuliya Bozhko added a comment - Need to adjust this fix since messaging now allows attachments.
            Hide
            Yuliya Bozhko added a comment -

            Will add testing instructions shortly.

            Show
            Yuliya Bozhko added a comment - Will add testing instructions shortly.
            Hide
            Rajesh Taneja added a comment -

            Thanks for fixing this Yuliya,

            Patch looks good, just one question about "Badge creator notification".
            Should it be sent from noreply user? If yes, you can use core_user::get_noreply_user().

            Rest all looks good, feel free to push it for integration once ready.
            Also, please add testing instructions.

            Show
            Rajesh Taneja added a comment - Thanks for fixing this Yuliya, Patch looks good, just one question about "Badge creator notification". Should it be sent from noreply user? If yes, you can use core_user::get_noreply_user(). Rest all looks good, feel free to push it for integration once ready. Also, please add testing instructions.
            Hide
            Yuliya Bozhko added a comment -

            Thanks for the feedback, Rajesh! Will fix that!

            Show
            Yuliya Bozhko added a comment - Thanks for the feedback, Rajesh! Will fix that!
            Hide
            Yuliya Bozhko added a comment - - edited

            Submitting for integration.

            Added fix suggested by Rajesh, and discovered something that looks like a bug in messaging. Submitting a new tracker issue right now: MDL-42754.

            Show
            Yuliya Bozhko added a comment - - edited Submitting for integration. Added fix suggested by Rajesh, and discovered something that looks like a bug in messaging. Submitting a new tracker issue right now: MDL-42754 .
            Hide
            Dan Poltawski added a comment -

            Sorry - reopening, breaks on phpunit:

            PHP Fatal error:  Call to a member function get_pathnamehash() on a non-object in /Users/danp/moodles/im/moodle/lib/badgeslib.php on line 988
            PHP Stack trace:
            PHP   1. {main}() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:0
            PHP   2. PHPUnit_TextUI_Command::main() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:63
            PHP   3. PHPUnit_TextUI_Command->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
            PHP   4. PHPUnit_TextUI_TestRunner->doRun() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
            PHP   5. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
            PHP   6. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
            PHP   7. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
            PHP   8. PHPUnit_Framework_TestSuite->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
            PHP   9. PHPUnit_Framework_TestCase->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
            PHP  10. PHPUnit_Framework_TestResult->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
            PHP  11. advanced_testcase->runBare() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
            PHP  12. PHPUnit_Framework_TestCase->runBare() /Users/danp/moodles/im/moodle/lib/phpunit/classes/advanced_testcase.php:80
            PHP  13. PHPUnit_Framework_TestCase->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
            PHP  14. ReflectionMethod->invokeArgs() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
            PHP  15. core_badges_badgeslib_testcase->test_badges_observer_course_module_criteria_review() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
            PHP  16. completion_info->internal_set_data() /Users/danp/moodles/im/moodle/badges/tests/badgeslib_test.php:247
            PHP  17. core\event\base->trigger() /Users/danp/moodles/im/moodle/lib/completionlib.php:1052
            PHP  18. core\event\manager::dispatch() /Users/danp/moodles/im/moodle/lib/classes/event/base.php:502
            PHP  19. core\event\manager::process_buffers() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:74
            PHP  20. call_user_func() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154
            PHP  21. core_badges_observer::course_module_criteria_review() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154
            PHP  22. badge->issue() /Users/danp/moodles/im/moodle/badges/classes/observer.php:63
            PHP  23. badges_bake() /Users/danp/moodles/im/moodle/lib/badgeslib.php:411
             
            Fatal error: Call to a member function get_pathnamehash() on a non-object in /Users/danp/moodles/im/moodle/lib/badgeslib.php on line 988
             
            Call Stack:
                0.0002     228704   1. {main}() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:0
                0.0021     541648   2. PHPUnit_TextUI_Command::main() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:63
                0.0021     541880   3. PHPUnit_TextUI_Command->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
                4.1296  190206376   4. PHPUnit_TextUI_TestRunner->doRun() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
                4.1315  190361488   5. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
              239.6440  330954872   6. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
              239.6441  330955224   7. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
              244.1287  332683640   8. PHPUnit_Framework_TestSuite->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
              244.1287  332683640   9. PHPUnit_Framework_TestCase->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
              244.1288  332683640  10. PHPUnit_Framework_TestResult->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
              244.1288  332684584  11. advanced_testcase->runBare() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
              244.1290  332707064  12. PHPUnit_Framework_TestCase->runBare() /Users/danp/moodles/im/moodle/lib/phpunit/classes/advanced_testcase.php:80
              244.2873  334186816  13. PHPUnit_Framework_TestCase->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
              244.2873  334187648  14. ReflectionMethod->invokeArgs() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
              244.2873  334187680  15. core_badges_badgeslib_testcase->test_badges_observer_course_module_criteria_review() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
              244.3068  334810016  16. completion_info->internal_set_data() /Users/danp/moodles/im/moodle/badges/tests/badgeslib_test.php:247
              244.3080  334843760  17. core\event\base->trigger() /Users/danp/moodles/im/moodle/lib/completionlib.php:1052
              244.3080  334843808  18. core\event\manager::dispatch() /Users/danp/moodles/im/moodle/lib/classes/event/base.php:502
              244.3080  334843896  19. core\event\manager::process_buffers() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:74
              244.3081  334844624  20. call_user_func() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154
              244.3081  334844656  21. core_badges_observer::course_module_criteria_review() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154
              244.3421  334804624  22. badge->issue() /Users/danp/moodles/im/moodle/badges/classes/observer.php:63
              244.3470  334800840  23. badges_bake() /Users/danp/moodles/im/moodle/lib/badgeslib.php:411
            

            Show
            Dan Poltawski added a comment - Sorry - reopening, breaks on phpunit: PHP Fatal error: Call to a member function get_pathnamehash() on a non-object in /Users/danp/moodles/im/moodle/lib/badgeslib.php on line 988 PHP Stack trace: PHP 1. {main}() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:0 PHP 2. PHPUnit_TextUI_Command::main() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:63 PHP 3. PHPUnit_TextUI_Command->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129 PHP 4. PHPUnit_TextUI_TestRunner->doRun() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176 PHP 5. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349 PHP 6. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705 PHP 7. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705 PHP 8. PHPUnit_Framework_TestSuite->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745 PHP 9. PHPUnit_Framework_TestCase->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775 PHP 10. PHPUnit_Framework_TestResult->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783 PHP 11. advanced_testcase->runBare() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648 PHP 12. PHPUnit_Framework_TestCase->runBare() /Users/danp/moodles/im/moodle/lib/phpunit/classes/advanced_testcase.php:80 PHP 13. PHPUnit_Framework_TestCase->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838 PHP 14. ReflectionMethod->invokeArgs() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983 PHP 15. core_badges_badgeslib_testcase->test_badges_observer_course_module_criteria_review() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983 PHP 16. completion_info->internal_set_data() /Users/danp/moodles/im/moodle/badges/tests/badgeslib_test.php:247 PHP 17. core\event\base->trigger() /Users/danp/moodles/im/moodle/lib/completionlib.php:1052 PHP 18. core\event\manager::dispatch() /Users/danp/moodles/im/moodle/lib/classes/event/base.php:502 PHP 19. core\event\manager::process_buffers() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:74 PHP 20. call_user_func() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154 PHP 21. core_badges_observer::course_module_criteria_review() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154 PHP 22. badge->issue() /Users/danp/moodles/im/moodle/badges/classes/observer.php:63 PHP 23. badges_bake() /Users/danp/moodles/im/moodle/lib/badgeslib.php:411   Fatal error: Call to a member function get_pathnamehash() on a non-object in /Users/danp/moodles/im/moodle/lib/badgeslib.php on line 988   Call Stack: 0.0002 228704 1. {main}() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:0 0.0021 541648 2. PHPUnit_TextUI_Command::main() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/composer/bin/phpunit:63 0.0021 541880 3. PHPUnit_TextUI_Command->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129 4.1296 190206376 4. PHPUnit_TextUI_TestRunner->doRun() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176 4.1315 190361488 5. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349 239.6440 330954872 6. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705 239.6441 330955224 7. PHPUnit_Framework_TestSuite->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705 244.1287 332683640 8. PHPUnit_Framework_TestSuite->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745 244.1287 332683640 9. PHPUnit_Framework_TestCase->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775 244.1288 332683640 10. PHPUnit_Framework_TestResult->run() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783 244.1288 332684584 11. advanced_testcase->runBare() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648 244.1290 332707064 12. PHPUnit_Framework_TestCase->runBare() /Users/danp/moodles/im/moodle/lib/phpunit/classes/advanced_testcase.php:80 244.2873 334186816 13. PHPUnit_Framework_TestCase->runTest() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838 244.2873 334187648 14. ReflectionMethod->invokeArgs() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983 244.2873 334187680 15. core_badges_badgeslib_testcase->test_badges_observer_course_module_criteria_review() /Users/danp/moodles/im/moodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983 244.3068 334810016 16. completion_info->internal_set_data() /Users/danp/moodles/im/moodle/badges/tests/badgeslib_test.php:247 244.3080 334843760 17. core\event\base->trigger() /Users/danp/moodles/im/moodle/lib/completionlib.php:1052 244.3080 334843808 18. core\event\manager::dispatch() /Users/danp/moodles/im/moodle/lib/classes/event/base.php:502 244.3080 334843896 19. core\event\manager::process_buffers() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:74 244.3081 334844624 20. call_user_func() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154 244.3081 334844656 21. core_badges_observer::course_module_criteria_review() /Users/danp/moodles/im/moodle/lib/classes/event/manager.php:154 244.3421 334804624 22. badge->issue() /Users/danp/moodles/im/moodle/badges/classes/observer.php:63 244.3470 334800840 23. badges_bake() /Users/danp/moodles/im/moodle/lib/badgeslib.php:411
            Hide
            CiBoT added a comment -

            Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.

            Show
            CiBoT added a comment - Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.
            Hide
            Yuliya Bozhko added a comment -

            Ah sorry, Dan! I completely forgot that tests are actually testing message_send() now and debugging() doesn't exit the function. Fixed in https://github.com/totara/openbadges/commit/be2b37cf4b434848ac481f068a4850aece794050

            Show
            Yuliya Bozhko added a comment - Ah sorry, Dan! I completely forgot that tests are actually testing message_send() now and debugging() doesn't exit the function. Fixed in https://github.com/totara/openbadges/commit/be2b37cf4b434848ac481f068a4850aece794050
            Hide
            Yuliya Bozhko added a comment - - edited

            Fixed git URL and resubmitted for integration.

            Show
            Yuliya Bozhko added a comment - - edited Fixed git URL and resubmitted for integration.
            Hide
            Damyon Wiese added a comment -

            Thanks Yuliya, Integrated to master only. Unit tests and behat tests are passing with this change.

            Show
            Damyon Wiese added a comment - Thanks Yuliya, Integrated to master only. Unit tests and behat tests are passing with this change.
            Hide
            Andrew Nicols added a comment -

            Passing - all works as expected.

            Just a note for future reference, please give UI instructions to get to things rather than the link. I think the fact that we need a link in the instructions suggests that the UI has some issues that we need to resolve.

            Also, I notice in the message:

            If there is no badge attached to this email, you can manage and download it from My badges page.

            Opening a new issue to propose that we remove the ambiguity when we know there is no attachment.

            Show
            Andrew Nicols added a comment - Passing - all works as expected. Just a note for future reference, please give UI instructions to get to things rather than the link. I think the fact that we need a link in the instructions suggests that the UI has some issues that we need to resolve. Also, I notice in the message: If there is no badge attached to this email, you can manage and download it from My badges page. Opening a new issue to propose that we remove the ambiguity when we know there is no attachment.
            Hide
            Doug Moody added a comment -

            I don't want to sound like an idiot, but I ASSUMED that this fix was all about popup messaging in Moodle. I get the impression that it is about Email messaging.
            Can someone clarify please? I am all in faor of internal, popup messages for users who are online and active. Is that not what this issue addresses?

            Show
            Doug Moody added a comment - I don't want to sound like an idiot, but I ASSUMED that this fix was all about popup messaging in Moodle. I get the impression that it is about Email messaging. Can someone clarify please? I am all in faor of internal, popup messages for users who are online and active. Is that not what this issue addresses?
            Hide
            Yuliya Bozhko added a comment -

            Hi Doug,

            Badges did not work with pop up messages earlier because they were sent as an email directly to a user. Changing badges code so that now they are using internal messaging system will ensure that when badge is issued it triggers a pop-up notification as well as an email to a user with a badge image attached. Users will also be able to control whether they want to get an email or notification through their messaging settings/preferences.

            Show
            Yuliya Bozhko added a comment - Hi Doug, Badges did not work with pop up messages earlier because they were sent as an email directly to a user. Changing badges code so that now they are using internal messaging system will ensure that when badge is issued it triggers a pop-up notification as well as an email to a user with a badge image attached. Users will also be able to control whether they want to get an email or notification through their messaging settings/preferences.
            Hide
            Doug Moody added a comment -

            Thanks Yuliya. But it just occured to me that someone ought to test whether if a student does NOT have an email address, whether badges will send a popup message anyway. There are many situations where this might happen. I have 217 students who do not have email addresses. I would hate for them not to receive notice simply because of that!
            Hope someone will test that scenario.

            Show
            Doug Moody added a comment - Thanks Yuliya. But it just occured to me that someone ought to test whether if a student does NOT have an email address, whether badges will send a popup message anyway. There are many situations where this might happen. I have 217 students who do not have email addresses. I would hate for them not to receive notice simply because of that! Hope someone will test that scenario.
            Hide
            Yuliya Bozhko added a comment -

            Badges messages will be handled the way Moodle currently handles messages to the users without emails. I am just passing a user object to a function and messaging libraries are doing the rest. If it works for your students with forum posts or other kind of messages, it will work with badges notifications as well. It might be worth to have debugging turned off on your web site, otherwise you will be getting warnings that emails could not be sent to users without email address. But other than that all messages will be sent internally.

            Show
            Yuliya Bozhko added a comment - Badges messages will be handled the way Moodle currently handles messages to the users without emails. I am just passing a user object to a function and messaging libraries are doing the rest. If it works for your students with forum posts or other kind of messages, it will work with badges notifications as well. It might be worth to have debugging turned off on your web site, otherwise you will be getting warnings that emails could not be sent to users without email address. But other than that all messages will be sent internally.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            It's Friday, I'm tired so I won't be very imaginative today.

            No matter of that, yes, you did it! Thanks for your collaboration!

            Closing this as fixed!

            Show
            Eloy Lafuente (stronk7) added a comment - It's Friday, I'm tired so I won't be very imaginative today. No matter of that, yes, you did it! Thanks for your collaboration! Closing this as fixed!
            Hide
            Helen Foster added a comment -

            Just noting a few things I noticed with regard to this feature:

            • The badge recipient notification instant message appears to be sent from the primary site admin for site badges. I guess it makes sense, but it came as a surprise, since the notification email has the issuer name and contact set as From address.
            • By default, badge recipient notifications are sent via instant message when a user is logged in or offline and are sent via email when a user is offline. These seem like odd defaults to me. If anyone else thinks so too, please create a new issue for it.

            PS The testing instructions for this issue (about attaching a badge to an email) do not seem to match the issue summary (about badge notifications sent via Moodle instant messaging).

            Show
            Helen Foster added a comment - Just noting a few things I noticed with regard to this feature: The badge recipient notification instant message appears to be sent from the primary site admin for site badges. I guess it makes sense, but it came as a surprise, since the notification email has the issuer name and contact set as From address. By default, badge recipient notifications are sent via instant message when a user is logged in or offline and are sent via email when a user is offline. These seem like odd defaults to me. If anyone else thinks so too, please create a new issue for it. PS The testing instructions for this issue (about attaching a badge to an email) do not seem to match the issue summary (about badge notifications sent via Moodle instant messaging).

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: