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

Add new messaging preferences per users allowing them to filter who can message them

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      It should be covered by Behat. However, here there are also some manual tests.

      Before MDL-63279  gets integrated, you can add manually the $CFG->messagingallusers to your config.php for testing it.

      Setup

      1. Login as admin
      2. Enable 'Enable users to message anyone' ($CFG->messagingallusers) in  'Site Administration | Advanced Features' 
      3. Create 1 new course ('Course 1')
      4. Create 3 new users (user1, user2 and user3) and enrol them on the 'Course 1'
      5. Login as user1
      6. Access to the user3 profile page (from the course participants page) and add him as a contact
      7. Login as user3
      8. Approve the contact request from user1
      9. Login as admin
      10. Unenrol user3 from 'Course 1'

      Testing scenario 1: $CFG->messagingallusers enabled

      1. Login as user1
      2. Access to Participants list of the 'Course 1' and click over user2
      3. Send him a message
        • CHECK the message is sent
      4. Select user3 from Contacts tab in Messages
      5. Send her a message
        • CHECK the message is sent
      6. Login as user2
      7. Go to 'Message preferences' from the user profile preferences
        • CHECK a radio button is displayed instead of the 'Prevent non-contacts from messaging me' checkbox
        • CHECK the option 'Anyone on the site' is displayed and checked.
      8. Set the messaging preference to ' My contacts only'
      9. Login as user1
      10. Access to Participants list of the 'Course 1' and click over user2
      11. Send him a message
        • CHECK the message is NOT sent. An error message with the cause will be displayed (something like 'You can\'t message {$a} due to their message preferences. Try adding them as a contact.')

      Testing scenario 2: $CFG->messagingallusers disabled

      1. Login as admin
      2. Disable 'Enable users to message anyone' ($CFG->messagingallusers) in  'Site Administration | Advanced Features' 
      3. Login as user3
      4. Go to 'Message preferences' from the user profile preferences
        • CHECK the option 'Anyone on the site' is NOT displayed
        • CHECK 'My contacts and anyone in my courses' is the selected option
      5. Login as user1
      6. Access to Contacts tab in Messages and select user3
      7. Send her a message
        • CHECK the message is sent
      8. Access to Participants list of the 'Course 1' and click over user2
      9. Send him a message
        • CHECK the message is NOT sent. An error message with the cause will be displayed (something like 'You can\'t message {$a} due to their message preferences. Try adding them as a contact.')
      10. Login as user2
      11. Go to 'Message preferences' from the user profile preferences
      12. Set the messaging preference to ' My contacts and anyone in my courses'
      13. Login as user1
      14. Access to Participants list of the 'Course 1' and click over user2
      15. Send him a message
        • CHECK the message now is sent

       

      Show
      It should be covered by Behat. However, here there are also some manual tests. Before  MDL-63279   gets integrated, you can add manually the $CFG->messagingallusers to your config.php for testing it. Setup Login as admin Enable 'Enable users to message anyone' ($CFG->messagingallusers) in  'Site Administration | Advanced Features'  Create 1 new course ('Course 1') Create 3 new users (user1, user2 and user3) and enrol them on the 'Course 1' Login as user1 Access to the user3 profile page (from the course participants page) and add him as a contact Login as user3 Approve the contact request from user1 Login as admin Unenrol user3 from 'Course 1' Testing scenario 1: $CFG->messagingallusers enabled Login as user1 Access to Participants list of the 'Course 1' and click over user2 Send him a message CHECK the message is sent Select user3 from Contacts tab in Messages Send her a message CHECK the message is sent Login as user2 Go to 'Message preferences' from the user profile preferences CHECK a radio button is displayed instead of the 'Prevent non-contacts from messaging me' checkbox CHECK the option 'Anyone on the site' is displayed and checked. Set the messaging preference to ' My contacts only' Login as user1 Access to Participants list of the 'Course 1' and click over user2 Send him a message CHECK the message is NOT sent. An error message with the cause will be displayed (something like 'You can\'t message {$a} due to their message preferences. Try adding them as a contact.') Testing scenario 2: $CFG->messagingallusers disabled Login as admin Disable 'Enable users to message anyone' ($CFG->messagingallusers) in  'Site Administration | Advanced Features'  Login as user3 Go to 'Message preferences' from the user profile preferences CHECK the option 'Anyone on the site' is NOT displayed CHECK 'My contacts and anyone in my courses' is the selected option Login as user1 Access to Contacts tab in Messages and select user3 Send her a message CHECK the message is sent Access to Participants list of the 'Course 1' and click over user2 Send him a message CHECK the message is NOT sent. An error message with the cause will be displayed (something like 'You can\'t message {$a} due to their message preferences. Try adding them as a contact.') Login as user2 Go to 'Message preferences' from the user profile preferences Set the messaging preference to ' My contacts and anyone in my courses' Login as user1 Access to Participants list of the 'Course 1' and click over user2 Send him a message CHECK the message now is sent  
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63214-master

      Description

      Scope:
      We should allow users to choose who can message them, with a 'growing circle of contactability', if you will, with options for:
      'my contacts only'
      'my contacts and anyone who shares a course with me'
      'anyone on the site' (conditional) see blocker issue.

      This issue will also need to update any associated back end apis and webservices relating to message creation. 

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 days
                  2d
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours Time Not Required
                  5h