mirror of
https://github.com/zoriya/flood.git
synced 2026-06-03 11:16:36 +00:00
server: use "dateFinished" for more accurate download completion notification
This commit is contained in:
@@ -58,14 +58,14 @@ class NotificationService extends BaseService<NotificationServiceEvents> {
|
||||
* @param {Array<Notification>} notifications - Notifications to add
|
||||
* @return {Promise<void>} - Rejects with error.
|
||||
*/
|
||||
async addNotification(notifications: Array<Pick<Notification, 'id' | 'data'>>): Promise<void> {
|
||||
async addNotification(notifications: Array<Pick<Notification, 'id' | 'data'>>, ts = Date.now()): Promise<void> {
|
||||
this.count.total += notifications.length;
|
||||
this.count.unread += notifications.length;
|
||||
|
||||
await this.db
|
||||
.insert(
|
||||
notifications.map((notification) => ({
|
||||
ts: Date.now(),
|
||||
ts,
|
||||
data: notification.data,
|
||||
id: notification.id,
|
||||
read: false,
|
||||
|
||||
Reference in New Issue
Block a user