-
Type:
Improvement
-
Status: Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 3.6
-
Fix Version/s: 3.6
-
Component/s: Messages
-
Testing Instructions:
-
Affected Branches:MOODLE_36_STABLE
-
Fixed Branches:MOODLE_36_STABLE
-
Epic Link:
-
Pull from Repository:
-
Pull Master Branch:
MDL-63850_master -
Pull Master Diff URL:
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;
|