handle template archived

This commit is contained in:
Pete Matsyburka
2026-06-09 19:34:58 +03:00
parent 7784346a97
commit 28f47e1093
3 changed files with 12 additions and 0 deletions
+4
View File
@@ -75,6 +75,10 @@ module Mcp
return { content: [{ type: 'text', text: 'Template not found' }], isError: true } unless template
if template.archived_at?
return { content: [{ type: 'text', text: 'Template has been archived' }], isError: true }
end
current_ability.authorize!(:create, Submission.new(template:, account_id: current_user.account_id))
return { content: [{ type: 'text', text: 'Template has no fields' }], isError: true } if template.fields.blank?