fix(photos): копия фото не наследует отредактированную версию

Clone переносил все привязки photo_objects, включая роли edit*, хотя
правка принадлежит фото, чьи правки её породили. Теперь копия делит
только обычные варианты и показывается в исходном виде.

- EditRoles() и IsEditRole() в edit_render.go — единый список ролей;
- фильтр edit-ролей в Store.Clone и SQLiteStore.Clone;
- миграции 000016 (Postgres) и 000008 (SQLite) убирают привязки у
  копий, созданных до фикса;
- контрактная проверка копирования, сервисные и e2e-тесты.
This commit is contained in:
iu
2026-10-21 21:01:33 +03:00
parent 759e78ff79
commit 8dd8cb6f0c
12 changed files with 344 additions and 6 deletions
@@ -0,0 +1,3 @@
-- The removed bindings cannot be restored: which object belonged to which copy
-- is not recorded anywhere. Rollback of the code is enough - the edited
-- versions of the photos that own them stay untouched.
@@ -0,0 +1,10 @@
-- The edited version belongs to the photo whose edits produced it. Copies made
-- before the fix still carried the edit bindings, so a photo without edit
-- parameters showed the edited picture. Drop those bindings: the objects
-- become collectable garbage and the copies show the original picture again.
DELETE FROM photo_objects
WHERE role IN ('edit', 'edit_thumb', 'edit_medium', 'edit_preview')
AND photo_id IN (
SELECT id FROM photos WHERE edit_params IS NULL OR edit_params = '{}'::jsonb
);
@@ -0,0 +1,3 @@
-- The removed bindings cannot be restored: which object belonged to which copy
-- is not recorded anywhere. Rollback of the code is enough - the edited
-- versions of the photos that own them stay untouched.
@@ -0,0 +1,10 @@
-- The edited version belongs to the photo whose edits produced it. Copies made
-- before the fix still carried the edit bindings, so a photo without edit
-- parameters showed the edited picture. Drop those bindings: the objects
-- become collectable garbage and the copies show the original picture again.
DELETE FROM photo_objects
WHERE role IN ('edit', 'edit_thumb', 'edit_medium', 'edit_preview')
AND photo_id IN (
SELECT id FROM photos WHERE edit_params IS NULL OR edit_params = '{}'
);