Clone переносил все привязки photo_objects, включая роли edit*, хотя правка принадлежит фото, чьи правки её породили. Теперь копия делит только обычные варианты и показывается в исходном виде. - EditRoles() и IsEditRole() в edit_render.go — единый список ролей; - фильтр edit-ролей в Store.Clone и SQLiteStore.Clone; - миграции 000016 (Postgres) и 000008 (SQLite) убирают привязки у копий, созданных до фикса; - контрактная проверка копирования, сервисные и e2e-тесты.
11 lines
501 B
SQL
11 lines
501 B
SQL
-- 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 = '{}'
|
|
);
|