mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-03 16:17:59 +01:00
run formatter
This commit is contained in:
parent
39d53ee763
commit
14e6439ea7
7 changed files with 23 additions and 8 deletions
|
@ -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))
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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!")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue