-
Improvement
-
Resolution: Fixed
-
Blocker
-
3.6
-
MOODLE_36_STABLE
-
MOODLE_36_STABLE
-
MDL-63850_master -
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;
|