From 97ee38082cc16a1d670df09e16942054349ae692 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 6 Oct 2022 00:10:25 +0200 Subject: [PATCH] Handle deleted exercise in FilePolicy Fixes CODEOCEAN-DZ --- app/policies/code_ocean/file_policy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/policies/code_ocean/file_policy.rb b/app/policies/code_ocean/file_policy.rb index 450b5968..3ea9e2f6 100644 --- a/app/policies/code_ocean/file_policy.rb +++ b/app/policies/code_ocean/file_policy.rb @@ -3,7 +3,7 @@ module CodeOcean class FilePolicy < AdminOrAuthorPolicy def author? - @user == @record.context.author + @user == @record.context&.author end def show?