Where comment attachments are stored. By default Storage.store_file/2
leaves them at the media root; a host can place them next to the
commented record:
config :phoenix_kit_comments, :attachments_parent_folder, {MyApp.Media, :parent_for}called as parent_for(:comment_attachment, actor_uuid, %{resource_type: type, resource_uuid: uuid})
(or parent_for(:comment_attachment, actor_uuid)), returning {:ok, folder_uuid} or nil.
The component asks once per comment and places every file of that comment
with the answer. Nothing here raises or exits into the caller: it runs
inside consume_uploaded_entries/3, after the files are already stored,
so a crash would lose the comment and keep its uploads.
Summary
Functions
Asks the host hook where attachments for resource_type/resource_uuid
should live. nil (no config, no clause, a nil or non-uuid answer, or
the hook raising or exiting) means "leave it at the media root" — the
default behaviour.
Puts a just-stored file into folder_uuid (an answer from
parent_folder_uuid/3) by core's attach rule: a homeless file is adopted,
a file homed elsewhere gains a folder link. nil is a no-op. Always :ok;
a failure is logged and the file stays where storage put it.
place_file/2 with the folder asked from the hook for this one file.
Functions
Asks the host hook where attachments for resource_type/resource_uuid
should live. nil (no config, no clause, a nil or non-uuid answer, or
the hook raising or exiting) means "leave it at the media root" — the
default behaviour.
@spec place_file( PhoenixKit.Modules.Storage.File.t() | %{uuid: String.t()}, String.t() | nil ) :: :ok
Puts a just-stored file into folder_uuid (an answer from
parent_folder_uuid/3) by core's attach rule: a homeless file is adopted,
a file homed elsewhere gains a folder link. nil is a no-op. Always :ok;
a failure is logged and the file stays where storage put it.
@spec place_stored_file( PhoenixKit.Modules.Storage.File.t() | %{uuid: String.t()}, String.t(), String.t(), String.t() | nil ) :: :ok
place_file/2 with the folder asked from the hook for this one file.