mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
mix format
This commit is contained in:
parent
7fca37741b
commit
3141db8bf2
9 changed files with 29 additions and 16 deletions
|
@ -139,6 +139,7 @@ defmodule Philomena.Reports do
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_reindex_report(result), do: result
|
defp maybe_reindex_report(result), do: result
|
||||||
|
|
||||||
def reindex_reports(report_ids) do
|
def reindex_reports(report_ids) do
|
||||||
|
|
|
@ -15,7 +15,9 @@ defmodule PhilomenaWeb.Image.NavigateController do
|
||||||
filter = conn.assigns.compiled_filter
|
filter = conn.assigns.compiled_filter
|
||||||
rel = String.to_existing_atom(rel)
|
rel = String.to_existing_atom(rel)
|
||||||
|
|
||||||
next_image = ImageNavigator.find_consecutive(conn, image, rel, params, compile_query(conn), filter)
|
next_image =
|
||||||
|
ImageNavigator.find_consecutive(conn, image, rel, params, compile_query(conn), filter)
|
||||||
|
|
||||||
scope = ImageScope.scope(conn)
|
scope = ImageScope.scope(conn)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -29,7 +29,7 @@ defmodule PhilomenaWeb.Tag.AutocompleteController do
|
||||||
Tag |> preload(:aliased_tag)
|
Tag |> preload(:aliased_tag)
|
||||||
)
|
)
|
||||||
|> Enum.map(&(&1.aliased_tag || &1))
|
|> Enum.map(&(&1.aliased_tag || &1))
|
||||||
|> Enum.uniq_by(&(&1.id))
|
|> Enum.uniq_by(& &1.id)
|
||||||
|> Enum.sort_by(&(-&1.images_count))
|
|> Enum.sort_by(&(-&1.images_count))
|
||||||
|> Enum.map(&%{label: "#{&1.name} (#{&1.images_count})", value: &1.name})
|
|> Enum.map(&%{label: "#{&1.name} (#{&1.images_count})", value: &1.name})
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,7 +61,10 @@ defmodule PhilomenaWeb.TagController do
|
||||||
body = TextileRenderer.render_one(%{body: tag.description || ""}, conn)
|
body = TextileRenderer.render_one(%{body: tag.description || ""}, conn)
|
||||||
|
|
||||||
dnp_bodies =
|
dnp_bodies =
|
||||||
TextileRenderer.render_collection(Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), conn)
|
TextileRenderer.render_collection(
|
||||||
|
Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}),
|
||||||
|
conn
|
||||||
|
)
|
||||||
|
|
||||||
dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries)
|
dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries)
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,9 @@ defmodule PhilomenaWeb.TopicController do
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, "There was an error with your submission. Please try again.")
|
|> put_flash(:error, "There was an error with your submission. Please try again.")
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, conn.assigns.topic))
|
|> redirect(
|
||||||
|
to: Routes.forum_topic_path(conn, :show, conn.assigns.forum, conn.assigns.topic)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,10 @@ defmodule PhilomenaWeb.ImageLoader do
|
||||||
|
|
||||||
defp render_bodies([tag], conn) do
|
defp render_bodies([tag], conn) do
|
||||||
dnp_bodies =
|
dnp_bodies =
|
||||||
TextileRenderer.render_collection(Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), conn)
|
TextileRenderer.render_collection(
|
||||||
|
Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}),
|
||||||
|
conn
|
||||||
|
)
|
||||||
|
|
||||||
dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries)
|
dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries)
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,7 @@ defmodule PhilomenaWeb.StatsUpdater do
|
||||||
|
|
||||||
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
||||||
|
|
||||||
static_page =
|
static_page = %{
|
||||||
%{
|
|
||||||
title: "Statistics",
|
title: "Statistics",
|
||||||
slug: "stats",
|
slug: "stats",
|
||||||
body: Phoenix.HTML.safe_to_string(result),
|
body: Phoenix.HTML.safe_to_string(result),
|
||||||
|
@ -70,7 +69,10 @@ defmodule PhilomenaWeb.StatsUpdater do
|
||||||
updated_at: now
|
updated_at: now
|
||||||
}
|
}
|
||||||
|
|
||||||
Repo.insert_all(StaticPage, [static_page], on_conflict: {:replace, [:body, :updated_at]}, conflict_target: :slug)
|
Repo.insert_all(StaticPage, [static_page],
|
||||||
|
on_conflict: {:replace, [:body, :updated_at]},
|
||||||
|
conflict_target: :slug
|
||||||
|
)
|
||||||
|
|
||||||
run()
|
run()
|
||||||
end
|
end
|
||||||
|
|
|
@ -110,7 +110,7 @@ defmodule PhilomenaWeb.TextileRenderer do
|
||||||
|> Enum.flat_map(fn t ->
|
|> Enum.flat_map(fn t ->
|
||||||
Regex.scan(~r|>>(\d+)|, t, capture: :all_but_first)
|
Regex.scan(~r|>>(\d+)|, t, capture: :all_but_first)
|
||||||
|> Enum.map(fn [first] -> String.to_integer(first) end)
|
|> Enum.map(fn [first] -> String.to_integer(first) end)
|
||||||
|> Enum.filter(&(&1 < 2147483647))
|
|> Enum.filter(&(&1 < 2_147_483_647))
|
||||||
end)
|
end)
|
||||||
|> load_images()
|
|> load_images()
|
||||||
end
|
end
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -67,7 +67,7 @@ defmodule Philomena.MixProject do
|
||||||
{:tesla, "~> 1.3"},
|
{:tesla, "~> 1.3"},
|
||||||
{:castore, "~> 0.1"},
|
{:castore, "~> 0.1"},
|
||||||
{:mint, "~> 1.0"},
|
{:mint, "~> 1.0"},
|
||||||
{:dialyxir, "~> 1.0", only: :dev, runtime: false},
|
{:dialyxir, "~> 1.0", only: :dev, runtime: false}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue