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:
@@ -19,6 +19,22 @@ const (
|
||||
RoleEditPreview = "edit_preview"
|
||||
)
|
||||
|
||||
// EditRoles lists the roles of the edited version. The edited version belongs
|
||||
// to the photo whose edits produced it, so copies of that photo never share
|
||||
// these roles.
|
||||
func EditRoles() []string {
|
||||
return []string{RoleEdit, RoleEditThumb, RoleEditMedium, RoleEditPreview}
|
||||
}
|
||||
|
||||
// IsEditRole reports whether the role belongs to the edited version.
|
||||
func IsEditRole(role string) bool {
|
||||
switch role {
|
||||
case RoleEdit, RoleEditThumb, RoleEditMedium, RoleEditPreview:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// applyLight renders the light adjustments into a copy of the image. The
|
||||
// original pixels are never modified in place.
|
||||
func applyLight(src image.Image, p LightParams) *image.NRGBA {
|
||||
|
||||
Reference in New Issue
Block a user