mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-07-06 19:07:49 +02:00
inbox: use pgp encryption (#70)
* inbox: use pgp encryption && other fixes * fix inbox key last used at time * remove inbox items if keys change or same item id syncs * inbox:update inbox sync item * rename item field to sync * add alg field * sync: delete inbox items after commit succeeds * user: merge if conditions --------- Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
This commit is contained in:
@@ -132,13 +132,19 @@ namespace Notesnook.API.Hubs
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
try
|
||||
{
|
||||
|
||||
var UpsertItems = UpsertActionsMap[pushItem.Type] ?? throw new Exception($"Invalid item type: {pushItem.Type}.");
|
||||
UpsertItems(pushItem.Items, userId, 1);
|
||||
|
||||
if (!await unit.Commit()) return 0;
|
||||
|
||||
await SyncDeviceService.AddIdsToOtherDevicesAsync(userId, deviceId, pushItem.Items.Select((i) => new ItemKey(i.ItemId, pushItem.Type)));
|
||||
|
||||
// we need to delete the inbox items from the inbox collection
|
||||
// after syncing to prevent them from being sent again in the
|
||||
// next fetch.
|
||||
var itemIds = pushItem.Items.Select(i => i.ItemId).ToList();
|
||||
await Repositories.InboxItems.DeleteManyAsync(i => i.UserId == userId && itemIds.Contains(i.ItemId));
|
||||
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user