Made file uploads display in drafts

This commit is contained in:
2026-03-30 14:56:24 -04:00
parent 830ee36f84
commit db57ac843b
3 changed files with 59 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ defmodule Mixer.Posts.MediaUploader do
def storage_dir(_version, {_file, scope}), do: "uploads/media/#{scope.id}"
def filename(_version, {file, _scope}) do
Path.basename(file.file_name, Path.extname(file.file_name))
Path.basename(file.file_name)
end
def s3_object_headers(_version, {file, _scope}) do

View File

@@ -42,8 +42,8 @@ defmodule Mixer.Posts.Tweet do
Ash.Changeset.after_action(changeset, fn _changeset, tweet ->
Mixer.Posts.Media
|> Ash.get!(media_id, authorize?: false)
|> Ash.Changeset.for_update(:link_to_tweet, %{tweet_id: tweet.id})
|> Ash.update!(actor: context.actor)
|> Ash.Changeset.for_update(:link_to_tweet, %{tweet_id: tweet.id}, actor: context.actor)
|> Ash.update!()
{:ok, tweet}
end)