このコミットが含まれているのは:
2026-06-26 00:21:33 +09:00
コミット 8304909c8c
26個のファイルの変更1251行の追加33行の削除
+18 -4
ファイルの表示
@@ -23,10 +23,7 @@ class MaterialSyncSuppressionRegistrar
private
def discard_existing_materials! suppression
Material.unscoped
.kept
.where(normalized_source_key: suppression.normalized_source_key)
.find_each do |material|
matching_materials(suppression).find_each do |material|
MaterialVersionRecorder.ensure_snapshot!(material, created_by_user: @created_by_user)
material.discard!
MaterialVersionRecorder.record!(material:,
@@ -34,4 +31,21 @@ class MaterialSyncSuppressionRegistrar
created_by_user: @created_by_user)
end
end
def matching_materials suppression
materials = Material.unscoped.kept
case suppression.source_kind
when 'google_drive_path', 'legacy_drive_path'
materials.where(source_path: suppression.drive_path)
when 'google_drive_path_prefix', 'legacy_drive_path_prefix'
path = suppression.drive_path.to_s
materials.where(
'source_path = :path OR source_path LIKE :prefix',
path:,
prefix: "#{ path }/%")
else
materials.where(normalized_source_key: suppression.normalized_source_key)
end
end
end