Skip to content

Commit eda0a54

Browse files
committed
Display new uploads immediately once their thumbnails were generated in dev env
1 parent 5ae8e89 commit eda0a54

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

config/dev.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ config :philomena, csp_relaxed: true
7878
# Enable Vite HMR
7979
config :philomena, vite_reload: true
8080

81+
# Display the uploads immediately once thumbnails are generated, we don't need
82+
# to wait more than that in dev mode.
83+
config :philomena, new_uploads_hidden_duration: "0 minutes"
84+
8185
# Set a higher stacktrace during development. Avoid configuring such
8286
# in production as building large stacktraces may be expensive.
8387
config :phoenix, :stacktrace_depth, 20

lib/philomena_web/controllers/activity_controller.ex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ defmodule PhilomenaWeb.ActivityController do
1717
alias Philomena.Repo
1818
import Ecto.Query
1919

20+
# Delay displaying new uploads on the homepage to give the users some time to
21+
# add last-minute tags on the image after the fact of upload.
22+
@new_uploads_hidden_duration Application.compile_env(
23+
:philomena,
24+
:new_uploads_hidden_duration,
25+
"3 minutes"
26+
)
27+
2028
def index(conn, _params) do
2129
user = conn.assigns.current_user
2230

2331
{:ok, {images, _tags}} =
2432
ImageLoader.search_string(
2533
conn,
26-
"created_at.lte:3 minutes ago, -thumbnails_generated:false",
34+
"created_at.lte:#{@new_uploads_hidden_duration} ago, -thumbnails_generated:false",
2735
pagination: %{conn.assigns.image_pagination | page_number: 1}
2836
)
2937

0 commit comments

Comments
 (0)