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

Load conversation counts and unread counts using ajax rather than on the server

    XMLWordPrintable

    Details

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

      Requirements

      1. Please test this on both the Clean and Boost themes.

      Set up

      1. Create a site with a course, a group with group messaging turned on, and 3 users enrolled in the course and group
      2. Make sure each of the user’s message privacy settings are configured to allow messages from other people in the same course or from anyone on the site

      Total conversation counts

      1. Log in as user 1
      2. Open the message drawer
      3. Wait a second or two (while it loads)
      4. CONFIRM that the “group messages” section opens
      5. CONFIRM that the total conversation count for each section is set correctly (the number in the parenthesis next to the section name). It should be “Favourites (0)”, “Group messages (1)”, and “Messages (0)”
      6. Search for user 2
      7. Send user 2 a message
      8. Click the “back” icon up the top left of the message drawer to go back to the overview page
      9. CONFIRM that the total count for the “Messages” section has changed from “(0)” to “(1)” (since you created a new conversation)).
      10. Search for user 3
      11. Send user 3 a message
      12. Click the “back” icon up the top left of the message drawer to go back to the overview page
      13. CONFIRM that the total count for the “Messages” section has changed from “(1)” to “(2)” (since you created a new conversation)).

      Unread conversation counts

      1. Log in as user 2
      2. Open the message drawer
      3. Wait a bit for it to load
      4. CONFIRM that the “Messages” section opens (because you have an unread message in there)
      5. CONFIRM that the total counts next to each section are “Favourites (0)”, “Group messages (1)”, and “Messages (1)”
      6. CONFIRM that there is an unread conversation count next to messages (the blue badge with a 1 in it on the right site of the “Messages” sections)
      7. View the conversation user 1
      8. Click the back icon to return to the overview
      9. CONFIRM that the unread conversation count (the blue badge thing) has disappeared)
      10. Search for user 3
      11. Send user 3 a message
      12. Go back to the overview page in the message drawer
      13. Expand the “Group messages” section and click on the group conversation
      14. Send a message in the group conversation

      Favourite counts

      1. Log in as user 3
      2. Open the message drawer
      3. Wait a bit for it to load
      4. CONFIRM that the “Group message” section opens
      5. CONFIRM that there are unread message counts for the “Group messages” and “Messages” sections
      6. View the group conversation and add it as a favourite
      7. Go back to the overview page of the message drawer
      8. CONFIRM that the “Favourites” total count has increased to 1 and the “Group messages” count has reduced to 0
      9. Reload the page
      10. Open the message drawer
      11. Give it a second to load
      12. CONFIRM that the “Messages” section opens (this is because it has unread messages in it)
      13. View each of the conversations in the “Messages” section to mark them as read
      14. Reload the page
      15. Open the message drawer
      16. Give it a second to load
      17. CONFIRM that the “Favourites” section opens (this is because there are no unread messages in any section)
      Show
      Requirements Please test this on both the Clean and Boost themes. Set up Create a site with a course, a group with group messaging turned on, and 3 users enrolled in the course and group Make sure each of the user’s message privacy settings are configured to allow messages from other people in the same course or from anyone on the site Total conversation counts Log in as user 1 Open the message drawer Wait a second or two (while it loads) CONFIRM that the “group messages” section opens CONFIRM that the total conversation count for each section is set correctly (the number in the parenthesis next to the section name). It should be “Favourites (0)”, “Group messages (1)”, and “Messages (0)” Search for user 2 Send user 2 a message Click the “back” icon up the top left of the message drawer to go back to the overview page CONFIRM that the total count for the “Messages” section has changed from “(0)” to “(1)” (since you created a new conversation)). Search for user 3 Send user 3 a message Click the “back” icon up the top left of the message drawer to go back to the overview page CONFIRM that the total count for the “Messages” section has changed from “(1)” to “(2)” (since you created a new conversation)). Unread conversation counts Log in as user 2 Open the message drawer Wait a bit for it to load CONFIRM that the “Messages” section opens (because you have an unread message in there) CONFIRM that the total counts next to each section are “Favourites (0)”, “Group messages (1)”, and “Messages (1)” CONFIRM that there is an unread conversation count next to messages (the blue badge with a 1 in it on the right site of the “Messages” sections) View the conversation user 1 Click the back icon to return to the overview CONFIRM that the unread conversation count (the blue badge thing) has disappeared) Search for user 3 Send user 3 a message Go back to the overview page in the message drawer Expand the “Group messages” section and click on the group conversation Send a message in the group conversation Favourite counts Log in as user 3 Open the message drawer Wait a bit for it to load CONFIRM that the “Group message” section opens CONFIRM that there are unread message counts for the “Group messages” and “Messages” sections View the group conversation and add it as a favourite Go back to the overview page of the message drawer CONFIRM that the “Favourites” total count has increased to 1 and the “Group messages” count has reduced to 0 Reload the page Open the message drawer Give it a second to load CONFIRM that the “Messages” section opens (this is because it has unread messages in it) View each of the conversations in the “Messages” section to mark them as read Reload the page Open the message drawer Give it a second to load CONFIRM that the “Favourites” section opens (this is because there are no unread messages in any section)
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull Master Branch:
      MDL-64139-master

      Description

      At the moment we render the conversation counts on the server which means they happen on each page load. This is unnecessary since the user may not event open the message drawer on each page load.

      More importantly it's turning out to be a very complex SQL query to calculate the counts which is going to make performance a real issue.

      Instead we should just send an ajax request for the conversation counts when the message drawer is opened. This will save us big time on performance.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

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

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 40 minutes
                  40m