MDL-63466 core_message: Add conversation support to get_messages
- The get_conversation_messages has been added to the API and the WS with the conversation identifier (convid) instead of the userto, to let get conversation messages and the members involved. - The cache has been also reviewed, to use the convid instead of the [userfrom, userto] keys. - The get_most_recent_conversation_messages has been added to the API to update the cache when needed.
This commit is contained in:
committed by
Jake Dallimore
parent
d89d0d6593
commit
fb04293bb1
@@ -28,7 +28,7 @@ namespace core_message;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Cache data source for the time of the last message between users.
|
||||
* Cache data source for the time of the last message in a conversation.
|
||||
*
|
||||
* @package core_message
|
||||
* @category cache
|
||||
@@ -61,9 +61,7 @@ class time_last_message_between_users implements \cache_data_source {
|
||||
* @return mixed What ever data should be returned, or false if it can't be loaded.
|
||||
*/
|
||||
public function load_for_cache($key) {
|
||||
list($userid1, $userid2) = explode('_', $key);
|
||||
|
||||
$message = api::get_most_recent_message($userid1, $userid2);
|
||||
$message = api::get_most_recent_conversation_message($key);
|
||||
|
||||
if ($message) {
|
||||
return $message->timecreated;
|
||||
|
||||
Reference in New Issue
Block a user