fix(captain-memory): always authorize index even when list is empty
This commit is contained in:
parent
f7d4c41d07
commit
8444209952
@ -4,7 +4,7 @@ class Api::V1::Accounts::Contacts::MemoriesController < Api::V1::Accounts::BaseC
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@memories = Captain::ContactMemory.active.for_contact(@contact.id).order(created_at: :desc)
|
@memories = Captain::ContactMemory.active.for_contact(@contact.id).order(created_at: :desc)
|
||||||
authorize(@memories.first || Captain::ContactMemory.new(account: @contact.account)) if @memories.any?
|
authorize(@memories.first || Captain::ContactMemory.new(account: @contact.account))
|
||||||
render json: { data: @memories.as_json(except: :embedding) }
|
render json: { data: @memories.as_json(except: :embedding) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user