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

Messaging: Update the message APIs allowing teachers to send 1:1 messages to students, regardless of their messaging prefs.

    XMLWordPrintable

    Details

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

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

      This should be integrated/tested at the same time (or later) than MDL-63214.

      Setup

      1. Login as admin
      2. Create 2 new courses
        1. Course 1
        2. Course 2
      3. Create 4 new users
        1. user1
        2. user2
        3. user3
        4. teacher1
      4. Enrol user1 and user2 as students on the 'Course 1'
      5. Enrol teacher1 as a teacher to the 'Course 1'
      6. Enrol user3 and teacher1 as students to the 'Course 2'
      7. Login as user1
      8. Access to the teacher1 profile page (from the course participants page) and block him as a contact following these steps:
        1. Click on the 'Message' icon near to the teacher name
        2. Click on the teacher name you'll find at the top of the message area (above the Online/Offline text)
        3. Click on the 'Block contact' link
      9. Login as user2
        1. Set the messaging preference to 'My contacts only'
      10. Login as user3
        1. Set the messaging preference to 'My contacts only'

      Testing scenario 1: Send 1:1 message as a teacher

      1. Login as teacher1
      2. Navigate to Course 1 => Participants => user1
      3. Click the Message link at the top of the profile
      4. Send a message
        1. Confirm that the message is sent
      5. Navigate to Course 1 => Participants => user2
      6. Click the Message link at the top of the profile
      7. Send a message
        1. Confirm that the message is sent
      8. Access to Participants list of the 'Course 2' and click over user3
      9. Click the Message link at the top of the profile
        1. Confirm that an error was shown

      Testing scenario 2: Send bulk message as a teacher

      1. Login as teacher1
      2. Navigate to Course 1 => Participants
      3. Select user1 and user2 and choose 'Send a message' from the 'With selected users...' list
      4. Write the message and click over the button to send it
      5. Login as user1
        1. Confirm that the message was received
      6. Login as user2
        1. Confirm that the message was received

      Test messaging unrelated users

      1. Login as user1
      2. From the Message icon (next to the User menu), choose "New message"
      3. In the "Search for a user or course" field, search for "user3"
      4. Attempt to send User 3 a message
        1. Confirm that you cannot

      Test with site messaging for all users

      1. Navigate to Site administration => Advanced features
      2. Tick the messagingallusers setting and save changes
      3. Login as user3
      4. From the user menu, choose Preferences
      5. Choose "Message preferences"
      6. Change the value to "Anyone on this site"
      7. Login as user1
      8. From the Message icon (next to the User menu), choose "New message"
      9. In the "Search for a user or course" field, search for "user3"
      10. Attempt to send User 3 a message
        1. Confirm that can now send user a message
      Show
      It should be covered by PHPUnit tests. However, here there are also some manual tests. This should be integrated/tested at the same time (or later) than MDL-63214 . Setup Login as admin Create 2 new courses Course 1 Course 2 Create 4 new users user1 user2 user3 teacher1 Enrol user1 and user2 as students on the 'Course 1' Enrol teacher1 as a  teacher to the 'Course 1' Enrol user3 and teacher1 as students to the 'Course 2' Login as user1 Access to the teacher1 profile page (from the course participants page) and block him as a contact following these steps: Click on the 'Message' icon near to the teacher name Click on the teacher name you'll find at the top of the message area (above the Online/Offline text) Click on the 'Block contact' link Login as user2 Set the messaging preference to 'My contacts only' Login as user3 Set the messaging preference to 'My contacts only' Testing scenario 1: Send 1:1 message as a teacher Login as teacher1 Navigate to Course 1 => Participants => user1 Click the Message link at the top of the profile Send a message Confirm that the message is sent Navigate to Course 1 => Participants => user2 Click the Message link at the top of the profile Send a message Confirm that the message is sent Access to Participants list of the 'Course 2' and click over user3 Click the Message link at the top of the profile Confirm that an error was shown Testing scenario 2: Send bulk message as a teacher Login as teacher1 Navigate to Course 1 => Participants Select user1 and user2 and choose 'Send a message' from the 'With selected users...' list Write the message and click over the button to send it Login as user1 Confirm that the message was received Login as user2 Confirm that the message was received Test messaging unrelated users Login as user1 From the Message icon (next to the User menu), choose " New message " In the " Search for a user or course " field, search for "user3" Attempt to send User 3 a message Confirm that you cannot Test with site messaging for all users Navigate to Site administration => Advanced features Tick the messagingallusers setting and save changes Login as user3 From the user menu, choose Preferences Choose "Message preferences" Change the value to "Anyone on this site" Login as user1 From the Message icon (next to the User menu), choose " New message " In the " Search for a user or course " field, search for "user3" Attempt to send User 3 a message Confirm that can now send user a message
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63289-master

      Description

      Scope:

      • There should be a capability, given by default to the 'Teacher' and 'Manager' roles on install/upgrade, allowing them to bypass user privacy preferences for messaging
      • Check 'message/classes/api.php' for can_post_message() - should respect this cap
      • Check 'lib/messagelib.php' for message_send() - should respect this cap
      • Other places?

        Attachments

        1. MDL-63289.PNG
          130 kB
          Anna Carissa Sadia
        2. messaging_preferences_behaviour.png
          102 kB
          Sara Arjona (@sarjona)
        3. newprivacysetting2.png
          13 kB
          Sara Arjona (@sarjona)

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                9 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 - 1 hour, 30 minutes Time Not Required
                  1h 30m