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()
doc_type = index.doc_type()
mapping =
index.mapping().mappings
|> Map.get(String.to_atom(doc_type))

View file

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

View file

@ -106,8 +106,13 @@ defmodule Philomena.Images.Thumbnailer do
defp image_file(%Image{image: 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}),
do: Path.join([image_thumbnail_root(), time_identifier(created_at), "#{id}-#{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}"])
defp image_thumb_dir(%Image{created_at: created_at, id: id}),
do: Path.join([image_thumbnail_root(), time_identifier(created_at), to_string(id)])

View file

@ -117,7 +117,7 @@ defmodule PhilomenaWeb.ActivityController do
layout_class: "layout--wide"
)
end
def filter_hidden(featured_image, nil, _hidden) do
featured_image
end
@ -128,6 +128,13 @@ defmodule PhilomenaWeb.ActivityController do
def filter_hidden(featured_image, user, _hidden) do
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

View file

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

View file

@ -67,7 +67,7 @@ defmodule PhilomenaWeb.ImageLoader do
end
# Allow moderators to index hidden images
defp maybe_show_deleted(filters, _show_hidden?, "1"),
do: filters

View file

@ -158,7 +158,9 @@ defmodule PhilomenaWeb.Router do
resources "/delete", Image.Comment.DeleteController, only: [:create], singleton: true
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 "/hash", Image.HashController, only: [:delete], singleton: true