MDL-63303 message: fix bugs in message drawer part 4

* Add clarification to delete messages lang strings
* Stop message polling when sending a message to fix UI bug
* Publish update last message event when polling finds more messages
* Remove logged in user from group conversation participants list
* Use user object to fetch user preferences to reduce DB calls
* Remove animated slide transitions because the browser breaks when
  showing some conversations
This commit is contained in:
Ryan Wyllie
2018-11-16 14:10:10 +08:00
parent 30538dc9c1
commit d3d95d5dc2
12 changed files with 32 additions and 153 deletions
+7 -2
View File
@@ -1797,7 +1797,7 @@ class api {
* @return int The default messaging preference.
*/
public static function get_user_privacy_messaging_preference(int $userid) : int {
global $CFG;
global $CFG, $USER;
// When $CFG->messagingallusers is enabled, default value for the messaging preference will be "Anyone on the site";
// otherwise, the default value will be "My contacts and anyone in my courses".
@@ -1806,7 +1806,12 @@ class api {
} else {
$defaultprefvalue = self::MESSAGE_PRIVACY_SITE;
}
$privacypreference = get_user_preferences('message_blocknoncontacts', $defaultprefvalue, $userid);
if ($userid == $USER->id) {
$user = $USER;
} else {
$user = $userid;
}
$privacypreference = get_user_preferences('message_blocknoncontacts', $defaultprefvalue, $user);
// When the $CFG->messagingallusers privacy setting is disabled, MESSAGE_PRIVACY_SITE is
// also disabled, so it has to be replaced to MESSAGE_PRIVACY_COURSEMEMBER.