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

Extend member info with additional fields

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.6
    • Fix Version/s: 3.6
    • Component/s: Messages
    • Labels:

      Description

      We need 2 additional fields for the new UI:
      $member->canmessage
      $member->requirescontact

      I'd suggest we add these to the output of the \core_message\helper::get_member_info() function, if they're cheap enough, and adjust the get_conversation_member_structure() method in externallib.php to reflect this.

      Here's some code that Ryan was using to mock this data in the UI at present (for reference of the logic only, we don't want to add more DB hits or method calls if we can avoid it.)

      $privacysetting = self::get_user_privacy_messaging_preference($otheruserid);
              $blocknoncontacts = $privacysetting = self::MESSAGE_PRIVACY_ONLYCONTACTS;
              $data->isblocked = self::is_blocked($userid, $otheruserid);
              $data->iscontact = self::is_contact($userid, $otheruserid);
              $data->canmessage = ($data->iscontact || !$blocknoncontacts) && !self::is_blocked($otheruserid, $userid);
              $data->contactrequests = $contactrequests;
              $data->requirescontact = $blocknoncontacts;

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              jaked Jake Dallimore
              Peer reviewer:
              Jake Dallimore
              Integrator:
              Andrew Nicols
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

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