mirror of
https://github.com/nextcloud/ocsms.git
synced 2026-08-11 16:32:55 +00:00
Added table to store last read date. This permit to set unread messages on first refresh of contact list. We need to handle it at first load too
Note: this is an experimental thing. We need to set this cursor for every conversation to get better precision
This commit is contained in:
@@ -93,6 +93,7 @@ class SmsController extends Controller {
|
||||
$contacts = array();
|
||||
|
||||
$countPhone = count($phoneList);
|
||||
$maxTS = 0;
|
||||
foreach ($phoneList as $number => $ts) {
|
||||
$fmtPN = preg_replace("#[ ]#","/", $number);
|
||||
if (isset($contactsSrc[$fmtPN])) {
|
||||
@@ -100,9 +101,15 @@ class SmsController extends Controller {
|
||||
$contacts[$fmtPN] = $contactsSrc[$fmtPN];
|
||||
$contacts[$fmtPN2] = $contactsSrc[$fmtPN];
|
||||
}
|
||||
|
||||
if ($ts > $maxTS) {
|
||||
$maxTS = $ts;
|
||||
}
|
||||
}
|
||||
|
||||
return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts));
|
||||
$this->smsMapper->setLastReadDate($this->userId, $maxTS);
|
||||
|
||||
return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts, "lastRead" => $maxTS));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user