mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-63303 message: add lastmessagedate to messagearea contact
This commit is contained in:
parent
ecb4755c91
commit
0802c38a2f
@ -306,11 +306,13 @@ class helper {
|
||||
// Store the message if we have it.
|
||||
$data->ismessaging = false;
|
||||
$data->lastmessage = null;
|
||||
$data->lastmessagedate = null;
|
||||
$data->messageid = null;
|
||||
if (isset($contact->smallmessage)) {
|
||||
$data->ismessaging = true;
|
||||
// Strip the HTML tags from the message for displaying in the contact area.
|
||||
$data->lastmessage = clean_param($contact->smallmessage, PARAM_NOTAGS);
|
||||
$data->lastmessagedate = $contact->timecreated;
|
||||
$data->useridfrom = $contact->useridfrom;
|
||||
if (isset($contact->messageid)) {
|
||||
$data->messageid = $contact->messageid;
|
||||
@ -608,6 +610,7 @@ class helper {
|
||||
$data->profileimageurlsmall = $conv->members[$otheruser->id]->profileimageurlsmall;
|
||||
$data->ismessaging = isset($conv->messages[0]->text) ? true : false;
|
||||
$data->lastmessage = $conv->messages[0]->text ? clean_param($conv->messages[0]->text, PARAM_NOTAGS) : null;
|
||||
$data->lastmessagedate = $conv->messages[0]->timecreated ?? null;
|
||||
$data->messageid = $conv->messages[0]->id ?? null;
|
||||
$data->isonline = $conv->members[$otheruser->id]->isonline ?? null;
|
||||
$data->isblocked = $conv->members[$otheruser->id]->isblocked ?? null;
|
||||
|
@ -83,6 +83,11 @@ class contact implements templatable, renderable {
|
||||
*/
|
||||
public $lastmessage;
|
||||
|
||||
/**
|
||||
* @var int The last message sent timestamp.
|
||||
*/
|
||||
public $lastmessagedate;
|
||||
|
||||
/**
|
||||
* @var bool Is the user online?
|
||||
*/
|
||||
@ -117,6 +122,7 @@ class contact implements templatable, renderable {
|
||||
$this->messageid = $contact->messageid;
|
||||
$this->ismessaging = $contact->ismessaging;
|
||||
$this->lastmessage = $contact->lastmessage;
|
||||
$this->lastmessagedate = $contact->lastmessagedate;
|
||||
$this->isonline = $contact->isonline;
|
||||
$this->isblocked = $contact->isblocked;
|
||||
$this->isread = $contact->isread;
|
||||
@ -140,6 +146,7 @@ class contact implements templatable, renderable {
|
||||
} else {
|
||||
$contact->lastmessage = null;
|
||||
}
|
||||
$contact->lastmessagedate = $this->lastmessagedate;
|
||||
$contact->showonlinestatus = is_null($this->isonline) ? false : true;
|
||||
$contact->isonline = $this->isonline;
|
||||
$contact->isblocked = $this->isblocked;
|
||||
|
@ -1033,6 +1033,7 @@ class core_message_external extends external_api {
|
||||
'ismessaging' => new external_value(PARAM_BOOL, 'If we are messaging the user'),
|
||||
'sentfromcurrentuser' => new external_value(PARAM_BOOL, 'Was the last message sent from the current user?'),
|
||||
'lastmessage' => new external_value(PARAM_NOTAGS, 'The user\'s last message'),
|
||||
'lastmessagedate' => new external_value(PARAM_INT, 'Timestamp for last message', VALUE_DEFAULT, null),
|
||||
'messageid' => new external_value(PARAM_INT, 'The unique search message id', VALUE_DEFAULT, null),
|
||||
'showonlinestatus' => new external_value(PARAM_BOOL, 'Show the user\'s online status?'),
|
||||
'isonline' => new external_value(PARAM_BOOL, 'The user\'s online status'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user