mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 21:47:59 +01:00
various fixes
This commit is contained in:
parent
47f379d82d
commit
912efc8dcd
4 changed files with 12 additions and 4 deletions
|
@ -25,3 +25,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spoiler-filter-code {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
|
@ -32,7 +32,7 @@ defmodule Philomena.Filters.Filter do
|
||||||
filter
|
filter
|
||||||
|> cast(attrs, [:spoilered_tag_list, :hidden_tag_list, :description, :name, :spoilered_complex_str, :hidden_complex_str])
|
|> cast(attrs, [:spoilered_tag_list, :hidden_tag_list, :description, :name, :spoilered_complex_str, :hidden_complex_str])
|
||||||
|> propagate_tag_lists()
|
|> propagate_tag_lists()
|
||||||
|> validate_required([:name])
|
|> validate_required([:name, :description])
|
||||||
|> unsafe_validate_unique([:user_id, :name], Repo)
|
|> unsafe_validate_unique([:user_id, :name], Repo)
|
||||||
|> validate_my_downvotes(:spoilered_complex_str)
|
|> validate_my_downvotes(:spoilered_complex_str)
|
||||||
|> validate_my_downvotes(:hidden_complex_str)
|
|> validate_my_downvotes(:hidden_complex_str)
|
||||||
|
|
|
@ -138,6 +138,7 @@ defmodule Philomena.Images.Image do
|
||||||
|> validate_number(:image_height, greater_than: 0, less_than_or_equal_to: 32767)
|
|> validate_number(:image_height, greater_than: 0, less_than_or_equal_to: 32767)
|
||||||
|> validate_length(:image_name, max: 255, count: :bytes)
|
|> validate_length(:image_name, max: 255, count: :bytes)
|
||||||
|> validate_inclusion(:image_mime_type, ~W(image/gif image/jpeg image/png image/svg+xml video/webm))
|
|> validate_inclusion(:image_mime_type, ~W(image/gif image/jpeg image/png image/svg+xml video/webm))
|
||||||
|
|> unsafe_validate_unique([:image_sha512_hash], Philomena.Repo)
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_changeset(image, attrs) do
|
def source_changeset(image, attrs) do
|
||||||
|
|
|
@ -23,9 +23,12 @@ defmodule PhilomenaWeb.PostView do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp author_name(object) do
|
defp author_name(object) do
|
||||||
case Attribution.anonymous?(object) do
|
cond do
|
||||||
true -> PhilomenaWeb.UserAttributionView.anonymous_name(object)
|
Attribution.anonymous?(object) || !object.user ->
|
||||||
false -> object.user.name
|
PhilomenaWeb.UserAttributionView.anonymous_name(object)
|
||||||
|
|
||||||
|
true ->
|
||||||
|
object.user.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue