propagate cookies correctly into form values

This commit is contained in:
byte[] 2020-01-11 14:35:02 -05:00
parent b1381de587
commit ce534b7962
2 changed files with 7 additions and 6 deletions

View file

@ -41,6 +41,7 @@ defmodule PhilomenaWeb.SettingController do
|> set_cookie(user_params, "serve_webm", "serve_webm") |> set_cookie(user_params, "serve_webm", "serve_webm")
|> set_cookie(user_params, "chan_nsfw", "chan_nsfw") |> set_cookie(user_params, "chan_nsfw", "chan_nsfw")
|> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools") |> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools")
|> set_cookie(user_params, "hide_uploader", "hide_uploader")
end end
defp set_cookie(conn, params, param_name, cookie_name) do defp set_cookie(conn, params, param_name, cookie_name) do

View file

@ -104,28 +104,28 @@ h1 Content Settings
.block.block--fixed.block--warning Settings on this tab are saved in the current browser. They are independent of your login. .block.block--fixed.block--warning Settings on this tab are saved in the current browser. They are independent of your login.
.field .field
=> label f, :hidpi, "Serve HiDPI thumbnails" => label f, :hidpi, "Serve HiDPI thumbnails"
=> checkbox f, :hidpi => checkbox f, :hidpi, value: @conn.cookies["hidpi"]
.fieldlabel: i Use high quality thumbnails on displays with a high pixel density. Requires more data than regular thumbnails. .fieldlabel: i Use high quality thumbnails on displays with a high pixel density. Requires more data than regular thumbnails.
.field .field
=> label f, :serve_webm, "Serve WebM" => label f, :serve_webm, "Serve WebM"
=> checkbox f, :serve_webm => checkbox f, :serve_webm, value: @conn.cookies["serve_webm"]
.fieldlabel: i Serve WebM/MP4 versions of GIF images when available. Good for lower-bandwidth connections, but the video versions may have missing start/end frames, and do not support transparency. .fieldlabel: i Serve WebM/MP4 versions of GIF images when available. Good for lower-bandwidth connections, but the video versions may have missing start/end frames, and do not support transparency.
.field .field
=> label f, :webm, "Use video thumbnails" => label f, :webm, "Use video thumbnails"
=> checkbox f, :webm => checkbox f, :webm, value: @conn.cookies["webm"]
.fieldlabel: i Use video thumbnails for WebM videos. Does not apply to GIF images. .fieldlabel: i Use video thumbnails for WebM videos. Does not apply to GIF images.
.field .field
=> label f, :hide_uploader => label f, :hide_uploader
=> checkbox f, :hide_uploader => checkbox f, :hide_uploader, value: @conn.cookies["hide_uploader"]
.fieldlabel: i Hide the uploader and date posted information on image pages. .fieldlabel: i Hide the uploader and date posted information on image pages.
.field .field
=> label f, :chan_nsfw, "Show NSFW channels" => label f, :chan_nsfw, "Show NSFW channels"
=> checkbox f, :chan_nsfw => checkbox f, :chan_nsfw, value: @conn.cookies["chan_nsfw"]
.fieldlabel: i Show streams marked as NSFW on the channels page. .fieldlabel: i Show streams marked as NSFW on the channels page.
= if staff?(@conn.assigns.current_user) do = if staff?(@conn.assigns.current_user) do
.field .field
=> label f, :hide_staff_tools => label f, :hide_staff_tools
=> checkbox f, :hide_staff_tools, class: "checkbox" => checkbox f, :hide_staff_tools, value: @conn.cookies["hide_staff_tools"]
.fieldlabel: i Hide most of the staff tools (e.g. IPs, anon names) making your site appear as if you weren't staff, this is useful when browsing in public. .fieldlabel: i Hide most of the staff tools (e.g. IPs, anon names) making your site appear as if you weren't staff, this is useful when browsing in public.
= if !@conn.assigns.current_user do = if !@conn.assigns.current_user do