This commit is contained in:
@ -197,10 +197,17 @@ case 'PUT':
|
||||
$oldKey = qdb_question_key($oldCfg, $row['defaultText']);
|
||||
$oldSymptoms = json_encode($oldCfg['symptoms'] ?? [], JSON_UNESCAPED_UNICODE);
|
||||
$newSymptoms = json_encode($config['symptoms'] ?? [], JSON_UNESCAPED_UNICODE);
|
||||
// Notes live in configJson and are exported as noteBeforeKey/noteAfterKey + translations.
|
||||
// App sync skips detail re-download when structureRevision is unchanged, so note-only
|
||||
// (and other app-visible config) edits must bump the revision.
|
||||
$oldNotes = trim((string)($oldCfg['noteBefore'] ?? '')) . "\0" . trim((string)($oldCfg['noteAfter'] ?? ''));
|
||||
$newNotes = trim((string)($config['noteBefore'] ?? '')) . "\0" . trim((string)($config['noteAfter'] ?? ''));
|
||||
$structuralChange = ($type !== (string)$row['type'])
|
||||
|| ($req !== (int)$row['isRequired'])
|
||||
|| ($questionKey !== $oldKey)
|
||||
|| ($newSymptoms !== $oldSymptoms);
|
||||
|| ($newSymptoms !== $oldSymptoms)
|
||||
|| ($oldNotes !== $newNotes)
|
||||
|| (json_encode($config, JSON_UNESCAPED_UNICODE) !== json_encode($oldCfg, JSON_UNESCAPED_UNICODE));
|
||||
if ((int)($row['retiredAt'] ?? 0) > 0) {
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
json_error('INVALID_FIELD', 'Cannot edit a retired question', 400);
|
||||
|
||||
Reference in New Issue
Block a user