run formatter

This commit is contained in:
byte[] 2020-02-01 11:04:11 -05:00
parent 39d53ee763
commit 14e6439ea7
7 changed files with 23 additions and 8 deletions

View file

@ -50,6 +50,7 @@ defmodule Philomena.Elasticsearch do
index_name = index.index_name() index_name = index.index_name()
doc_type = index.doc_type() doc_type = index.doc_type()
mapping = mapping =
index.mapping().mappings index.mapping().mappings
|> Map.get(String.to_atom(doc_type)) |> Map.get(String.to_atom(doc_type))

View file

@ -97,8 +97,7 @@ defmodule Philomena.Images.Query do
literal_fields: literal_fields:
fields[:literal_fields] ++ fields[:literal_fields] ++
~W(fingerprint upvoted_by downvoted_by true_uploader hidden_by deleted_by_user), ~W(fingerprint upvoted_by downvoted_by true_uploader hidden_by deleted_by_user),
ngram_fields: ngram_fields: fields[:ngram_fields] ++ ~W(deletion_reason),
fields[:ngram_fields] ++ ~W(deletion_reason),
ip_fields: ~W(ip), ip_fields: ~W(ip),
bool_fields: ~W(deleted), bool_fields: ~W(deleted),
aliases: aliases:

View file

@ -106,7 +106,12 @@ defmodule Philomena.Images.Thumbnailer do
defp image_file(%Image{image: image}), defp image_file(%Image{image: image}),
do: Path.join(image_file_root(), image) do: Path.join(image_file_root(), image)
defp image_thumb_dir(%Image{created_at: created_at, id: id, hidden_from_users: true, hidden_image_key: key}), defp image_thumb_dir(%Image{
created_at: created_at,
id: id,
hidden_from_users: true,
hidden_image_key: key
}),
do: Path.join([image_thumbnail_root(), time_identifier(created_at), "#{id}-#{key}"]) do: Path.join([image_thumbnail_root(), time_identifier(created_at), "#{id}-#{key}"])
defp image_thumb_dir(%Image{created_at: created_at, id: id}), defp image_thumb_dir(%Image{created_at: created_at, id: id}),

View file

@ -128,6 +128,13 @@ defmodule PhilomenaWeb.ActivityController do
def filter_hidden(featured_image, user, _hidden) do def filter_hidden(featured_image, user, _hidden) do
featured_image featured_image
|> where([i], fragment("NOT EXISTS(SELECT 1 FROM image_hides WHERE image_id = ? AND user_id = ?)", i.id, ^user.id)) |> where(
[i],
fragment(
"NOT EXISTS(SELECT 1 FROM image_hides WHERE image_id = ? AND user_id = ?)",
i.id,
^user.id
)
)
end end
end end

View file

@ -54,6 +54,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
case conn.assigns.image.hidden_from_users do case conn.assigns.image.hidden_from_users do
true -> true ->
conn conn
_false -> _false ->
conn conn
|> put_flash(:error, "Cannot change hide reason on a non-hidden image!") |> put_flash(:error, "Cannot change hide reason on a non-hidden image!")

View file

@ -158,7 +158,9 @@ defmodule PhilomenaWeb.Router do
resources "/delete", Image.Comment.DeleteController, only: [:create], singleton: true resources "/delete", Image.Comment.DeleteController, only: [:create], singleton: true
end end
resources "/delete", Image.DeleteController, only: [:create, :delete, :update], singleton: true resources "/delete", Image.DeleteController,
only: [:create, :delete, :update],
singleton: true
resources "/tamper", Image.TamperController, only: [:create], singleton: true resources "/tamper", Image.TamperController, only: [:create], singleton: true
resources "/hash", Image.HashController, only: [:delete], singleton: true resources "/hash", Image.HashController, only: [:delete], singleton: true