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:
@@ -150,6 +150,20 @@ class SmsMapper extends Mapper {
|
||||
}
|
||||
return $phoneList;
|
||||
}
|
||||
|
||||
public function setLastReadDate ($userId, $lastDate) {
|
||||
\OCP\DB::beginTransaction();
|
||||
$query = \OCP\DB::prepare('DELETE FROM *PREFIX*ocsms_user_datas ' .
|
||||
'WHERE user_id = ? AND datakey = ?');
|
||||
$query->execute(array($userId, 'lastReadDate'));
|
||||
|
||||
$query = \OCP\DB::prepare('INSERT INTO *PREFIX*ocsms_user_datas' .
|
||||
'(user_id, datakey, datavalue) VALUES ' .
|
||||
'(?,?,?)');
|
||||
$query->execute(array($userId, 'lastReadDate', $lastDate));
|
||||
\OCP\DB::commit();
|
||||
}
|
||||
|
||||
public function writeToDB ($userId, $smsList, $purgeAllSmsBeforeInsert = false) {
|
||||
\OCP\DB::beginTransaction();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user