refactored access to options on frontend

This commit is contained in:
zadam
2020-02-05 22:08:45 +01:00
parent 786bbbc160
commit 42017fde5f
32 changed files with 267 additions and 311 deletions
+1 -3
View File
@@ -110,9 +110,7 @@ async function updateEntity(entity) {
const primaryKey = entity[primaryKeyName];
if (entity.isChanged) {
if (entityName !== 'options' || entity.isSynced) {
await syncTableService.addEntitySync(entityName, primaryKey);
}
await syncTableService.addEntitySync(entityName, primaryKey);
if (!cls.isEntityEventsDisabled()) {
const eventPayload = {
+7 -4
View File
@@ -315,10 +315,13 @@ async function getSyncRecords(syncs) {
let length = 0;
for (const sync of syncs) {
const record = {
sync: sync,
entity: await getEntityRow(sync.entityName, sync.entityId)
};
const entity = await getEntityRow(sync.entityName, sync.entityId);
if (sync.entityName === 'options' && !entity.isSynced) {
continue;
}
const record = { sync, entity };
records.push(record);
+3
View File
@@ -92,6 +92,9 @@ async function fillInAdditionalProperties(sync) {
} else if (sync.entityName === 'note_reordering') {
sync.positions = await sql.getMap(`SELECT branchId, notePosition FROM branches WHERE isDeleted = 0 AND parentNoteId = ?`, [sync.entityId]);
}
else if (sync.entityName === 'options') {
sync.entity = await sql.getRow(`SELECT * FROM options WHERE name = ?`, [sync.entityId]);
}
}
async function sendPing(client) {