mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-12 12:08:02 +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()
|
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))
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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}),
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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!")
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue