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

Messaging breaks when "Personal messages between users" is disabled

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MDL-68070-master_messaging_fix
    • Hide

      Testing scenario 1: "Personal messages between users" is disabled

      NOTE: This has to be tested BOTH with a user that never has received a message from admin (meaning, no previous conversation between them exist) and also with a user that already has received a message from admin (meaning, a conversation between them already exist).

      1. Log in as an admin.
      2. At "Site Settings > Messaging > Notification Settings" set "Personal messages between users"  to disabled.
      3. Open an user's profile page and click the message icon next to the name.
      4. Send a message to the user student s1.
      5. Check the message is displayed and a red notification appears above with the following text: "The message could not be sent because personal messages between users (in Notification settings) has been disabled by a site administrator.".
      6. Logout.
      7. Login as student s1.
      8. Check there is no notification in the message icon near the user name (in the top-right corner).
      9. Access to the message drawer and select the user student s1.
      10. Check the user student s1 hasn't received any message from admin.

       

      Testing scenario 2: "Personal messages between users" is enabled

      1. Log in as an admin.
      2. At "Site Settings > Messaging > Notification Settings" set "Personal messages between users"  to enabled.
      3. Open an user's profile page and click the message icon next to the name.
      4. Inspect the page and access to the "Network" tab.
      5. Send a message to the user student s1.
      6. Check the message is displayed.
      7. Check there is no error for the "core_message_send_messages_to_conversation" call.
      8. Logout.
      9. Login as student s1.
      10. Check the message icon near the user name (in the top-right corner) has a notification.
      11. Access to the message drawer and select the user student s1.
      12. Check the user student s1 has received the message sent (it should be displayed in the conversation with admin).

       
       

      Show
      Testing scenario 1: "Personal messages between users" is disabled NOTE : This has to be tested BOTH with a user that never has received a message from admin (meaning, no previous conversation between them exist) and also with a user that already has received a message from admin (meaning, a conversation between them already exist). Log in as an admin. At "Site Settings > Messaging > Notification Settings" set "Personal messages between users"  to disabled. Open an user's profile page and click the message icon next to the name. Send a message to the user student s1. Check the message is displayed and a red notification appears above with the following text: "The message could not be sent because personal messages between users (in Notification settings) has been disabled by a site administrator.". Logout. Login as student s1. Check there is no notification in the message icon near the user name (in the top-right corner). Access to the message drawer and select the user student s1. Check the user student s1 hasn't received any message from admin.   Testing scenario 2: "Personal messages between users" is enabled Log in as an admin. At "Site Settings > Messaging > Notification Settings" set "Personal messages between users"  to enabled. Open an user's profile page and click the message icon next to the name. Inspect the page and access to the "Network" tab. Send a message to the user student s1. Check the message is displayed. Check there is no error for the "core_message_send_messages_to_conversation" call. Logout. Login as student s1. Check the message icon near the user name (in the top-right corner) has a notification. Access to the message drawer and select the user student s1. Check the user student s1 has received the message sent (it should be displayed in the conversation with admin).    

      When "Personal messages between users" is disabled, attempting to send a message to a user results in the error messages:

      "timestamps => Invalid parameter value detected (timestamp => Invalid parameter value detected (Invalid external api parameter: the value is "NaN", the server was expecting "int" type): Invalid external api parameter: the value is "NaN", the server was expecting "int" type): timestamp => Invalid parameter value detected (Invalid external api parameter: the value is "NaN", the server was expecting "int" type): Invalid external api parameter: the value is "NaN", the server was expecting "int" type
      Error code: invalidparameter"

       

      AND

       

      Type Error
       
      message.userfrom is undefined
       

      Steps to replicate:

       

      As Admin, open the message settings

      http://tbc.test/admin/message.php

      Uncheck "Personal messages between users" in the "enabled" column.

      Save changes

      Open a user's profile page and click the message icon next to their name

      Try sending a message to the user

      Expected:

      Message sent

      Actual:

      See error messages already described.

       

      Suggested solution:

      In messagelib.php there is a function called "message_send".

      This function returns false if "personal messages between users" is set to disabled.

      This causes problems for the core_message_send_instant_messages which continues to send the response fields you would normally expect except that the id is null and the timecreated fields isn't a number.

      The webservice should throw an error to say that personal messages are disabled between users.

      A second improvement would be to modify the user interface so that it isn't possible to send messages when the "personal messages between uesrs" setting is disabled.
       

        1. image-2020-09-25-16-52-25-283.png
          7 kB
          Simon Mok
        2. image-2020-09-25-17-48-12-590.png
          10 kB
          Simon Mok
        3. image-2020-10-05-11-41-21-209.png
          12 kB
          Simon Mok
        4. image-2020-10-06-09-23-48-230.png
          32 kB
          Simon Mok
        5. image-2020-10-06-09-24-25-080.png
          8 kB
          Simon Mok
        6. image-2020-10-06-09-25-02-035.png
          15 kB
          Simon Mok
        7. MDL-68070.jpg
          62 kB
          Anna Carissa Sadia
        8. photo_2020-10-14_16-11-53.jpg
          8 kB
          Anna Carissa Sadia
        9. photo_2020-10-14_16-14-30.jpg
          6 kB
          Anna Carissa Sadia
        10. user_blocked_message.png
          15 kB
          Sara Arjona (@sarjona)

            simonmok_beenet Simon Mok
            brudinie guy thomas
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            24 Vote for this issue
            Watchers:
            24 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 2 hours, 32 minutes
                1d 2h 32m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.