Update home image query for staff users#479
Conversation
|
Make it a setting staff can toggle on/off, i can see it being useful to see what users see. |
|
I'm curious why do this if you can use search *? |
I added a new setting in a way that defaults to true for normal users and false for staff.
I've had this behavior in a userscript for probably over a year and it's really convenient to see new images on the home page directly, e.g. to find your own uploads. |
|
|
||
| - delay_home_images = if staff?(@conn.assigns.current_user), do: :staff_delay_home_images, else: :delay_home_images | ||
| = field_with_help( \ | ||
| "Delay images on the home page for 3 minutes and until thumbnails are generated", |
There was a problem hiding this comment.
"Show images on the homepage with a 3 minute delay, to ensure that the thumbnails are generated, and to allow uploaders to check their tagging after upload."
There was a problem hiding this comment.
3 minute delay isn't there to ensure the thumbnails are generated. There is a separate condition that ensures that:
must_not: [%{term: %{thumbnails_generated: false}}]
Thus, the current text proposed by @mdashlw is more accurate. Could be slightly "improved" (or worsened?) like this:
| "Delay images on the home page for 3 minutes and until thumbnails are generated", | |
| "Hide images without thumbnails on home page, and for the first 3 minutes after upload (to allow for last-minute tag updates)", |
But it probably makes sense to split this into two separate settings - for "no thumbnails generated" and "N minute delay"
There was a problem hiding this comment.
Another approach may be just a single input for "Home page search query" which defaults to the current
created_at.lte:3 minutes ago, -thumbnails_generated:false
Btw. just noticed that query could be simplified to this (unless I'm missing some caveat):
created_at.lte:3 minutes ago, thumbnails_generated:true
The description of this input would then explain why this query was chosen as the default one.
QAImages without thumbnails are shown by default for Administrator. If this setting is enabled: then images without thumbnails are not shown. Regular users also have access to this setting, but the delay is enabled by default for them. Not clear why we need separate |
|
@MareStare for different defaults for regular users and staff |
I see, Postgres doesn't allow using other columns of the row in the The existing code already has a similar logic at app level where it selects which of the fields to use ( if(is_nil(user.delay_home_images), do: user.role == "user", else: user.delay_home_images) |
|
@MareStare feel free to do this if you want. |
|
After I did this change (#561) I realized that with my suggested approach the following unwanted scenario will happen:
With separate |

Before you begin
closes #426