mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-07-10 04:21:21 +02:00
Do not refetch user before decrypting each chunk in sync (#9805)
* core: do not refetch user before decrypting each chunk in sync * web: fix editor readonly state not updating in realtime
This commit is contained in:
@@ -286,7 +286,8 @@ class EditorStore extends BaseStore<EditorStore> {
|
||||
const clearIds: string[] = [];
|
||||
for (const session of sessions) {
|
||||
if (session.type === "new") continue;
|
||||
if (session.note.id !== item.id && session.note.contentId !== item.id) continue;
|
||||
if (session.note.id !== item.id && session.note.contentId !== item.id)
|
||||
continue;
|
||||
if (isDeleted(item) || isTrashItem(item))
|
||||
clearIds.push(session.tabId);
|
||||
// if a note becomes conflicted, reopen the session
|
||||
@@ -331,6 +332,13 @@ class EditorStore extends BaseStore<EditorStore> {
|
||||
!item.readonly
|
||||
)
|
||||
openSession(session.note.id, { force: true, silent: true });
|
||||
// if a note is made readonly, reopen the session
|
||||
else if (
|
||||
session.type !== "readonly" &&
|
||||
item.type === "note" &&
|
||||
item.readonly
|
||||
)
|
||||
openSession(session.note.id, { force: true, silent: true });
|
||||
// update the note in all sessions
|
||||
else if (item.type === "note") {
|
||||
updateSession(
|
||||
|
||||
@@ -404,7 +404,9 @@ class UserManager {
|
||||
const masterKey = await this.getMasterKey();
|
||||
if (!masterKey) return;
|
||||
|
||||
const dataEncryptionKey = await this.keyManager.get("dataEncryptionKey");
|
||||
const dataEncryptionKey = await this.keyManager.get("dataEncryptionKey", {
|
||||
refetchUser: false
|
||||
});
|
||||
if (!dataEncryptionKey)
|
||||
return [
|
||||
{
|
||||
@@ -415,7 +417,10 @@ class UserManager {
|
||||
const keys: { version: KeyVersion; key: SerializedKey }[] = [];
|
||||
|
||||
const legacyDataEncryptionKey = await this.keyManager.get(
|
||||
"legacyDataEncryptionKey"
|
||||
"legacyDataEncryptionKey",
|
||||
{
|
||||
refetchUser: false
|
||||
}
|
||||
);
|
||||
if (legacyDataEncryptionKey)
|
||||
keys.push({
|
||||
|
||||
Reference in New Issue
Block a user