aboutsummaryrefslogtreecommitdiff
path: root/priv/repo
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2022-07-03 21:14:25 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2022-07-03 21:14:25 +0000
commitde37583c49bb43b67c009c36d42967dd9d117acb (patch)
tree2b94dbfbc7563d6cd8a7b52714b55e64ecbefd4c /priv/repo
parenta15b45a5897817a5a5accfb8fd0fa5bcf8515e2b (diff)
parent56227ef7ba097c6be39a7e70b67c426a3016e0ab (diff)
downloadpleroma-de37583c49bb43b67c009c36d42967dd9d117acb.tar.gz
Merge branch 'image_description_from_exif_data' into 'develop'
Use EXIF data of image for image description See merge request pleroma/pleroma!3535
Diffstat (limited to 'priv/repo')
-rw-r--r--priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs37
1 files changed, 37 insertions, 0 deletions
diff --git a/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs b/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs
new file mode 100644
index 000000000..0878b9699
--- /dev/null
+++ b/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs
@@ -0,0 +1,37 @@
+defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do
+ use Ecto.Migration
+
+ alias Pleroma.ConfigDB
+
+ def up,
+ do:
+ ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload})
+ |> update_filtername(
+ Pleroma.Upload.Filter.Exiftool,
+ Pleroma.Upload.Filter.Exiftool.StripLocation
+ )
+
+ def down,
+ do:
+ ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload})
+ |> update_filtername(
+ Pleroma.Upload.Filter.Exiftool.StripLocation,
+ Pleroma.Upload.Filter.Exiftool
+ )
+
+ defp update_filtername(%{value: value}, from_filtername, to_filtername) do
+ new_value =
+ value
+ |> Keyword.update(:filters, [], fn filters ->
+ filters
+ |> Enum.map(fn
+ ^from_filtername -> to_filtername
+ filter -> filter
+ end)
+ end)
+
+ ConfigDB.update_or_create(%{group: :pleroma, key: Pleroma.Upload, value: new_value})
+ end
+
+ defp update_filtername(_, _, _), do: nil
+end