mirror of
https://github.com/nextcloud/ocsms.git
synced 2026-08-11 16:32:55 +00:00
Implement Refresh conversation list and set new messages count into list
This commit is contained in:
@@ -170,6 +170,28 @@ class SmsController extends Controller {
|
||||
"phoneNumbers" => $phoneNumbers, "msgCount" => $msgCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function checkNewMessages($lastDate) {
|
||||
$phoneList = $this->smsMapper->getNewMessagesCountForAllPhonesNumbers($this->userId, $lastDate);
|
||||
$contactsSrc = $this->app->getContacts();
|
||||
$contacts = array();
|
||||
|
||||
$countPhone = count($phoneList);
|
||||
foreach ($phoneList as $number => $ts) {
|
||||
$fmtPN = preg_replace("#[ ]#","/", $number);
|
||||
if (isset($contactsSrc[$fmtPN])) {
|
||||
$fmtPN2 = preg_replace("#\/#","", $fmtPN);
|
||||
$contacts[$fmtPN] = $contactsSrc[$fmtPN];
|
||||
$contacts[$fmtPN2] = $contactsSrc[$fmtPN];
|
||||
}
|
||||
}
|
||||
|
||||
return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts));
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user