mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
respect user preference to be anonymous by default
This commit is contained in:
parent
9572ad0f21
commit
4796d3d628
8 changed files with 30 additions and 7 deletions
|
@ -26,5 +26,7 @@
|
|||
|
||||
.block__content.communication-edit__actions
|
||||
=> submit "Post", class: "button"
|
||||
= checkbox f, :anonymous
|
||||
= label f, :anonymous, "Anonymous"
|
||||
|
||||
= if @conn.assigns.current_user do
|
||||
= checkbox f, :anonymous, value: anonymous_by_default?(@conn)
|
||||
= label f, :anonymous, "Anonymous"
|
|
@ -85,7 +85,7 @@
|
|||
= if @conn.assigns.current_user do
|
||||
.field
|
||||
= label f, :anonymous, "Post anonymously"
|
||||
= checkbox f, :anonymous, class: "checkbox"
|
||||
= checkbox f, :anonymous, class: "checkbox", value: anonymous_by_default?(@conn)
|
||||
|
||||
.actions
|
||||
= submit "Upload", class: "button", autocomplete: "off", data: [disable_with: "Please wait..."]
|
|
@ -24,9 +24,10 @@
|
|||
= textarea fp, :body, class: "input input--wide input--text js-preview-input js-toolbar-input", placeholder: "Please read the site rules before posting and use [spoiler][/spoiler] for NSFW stuff in SFW forums.", required: true
|
||||
= error_tag fp, :body
|
||||
|
||||
.field
|
||||
=> checkbox f, :anonymous
|
||||
= label f, :anonymous, "Post anonymously"
|
||||
= if @conn.assigns.current_user do
|
||||
.field
|
||||
=> checkbox f, :anonymous, value: anonymous_by_default?(@conn)
|
||||
= label f, :anonymous, "Post anonymously"
|
||||
|
||||
= inputs_for f, :poll, fn fp ->
|
||||
#add-poll
|
||||
|
|
|
@ -25,4 +25,8 @@
|
|||
' [Loading preview...]
|
||||
|
||||
.block__content.communication-edit__actions
|
||||
= submit "Post", class: "button"
|
||||
= submit "Post", class: "button"
|
||||
|
||||
= if @conn.assigns.current_user do
|
||||
= checkbox f, :anonymous, value: anonymous_by_default?(@conn)
|
||||
= label f, :anonymous, "Anonymous"
|
|
@ -1,3 +1,7 @@
|
|||
defmodule PhilomenaWeb.Image.CommentView do
|
||||
use PhilomenaWeb, :view
|
||||
|
||||
def anonymous_by_default?(conn) do
|
||||
conn.assigns.current_user.anonymous_by_default
|
||||
end
|
||||
end
|
||||
|
|
|
@ -83,6 +83,10 @@ defmodule PhilomenaWeb.ImageView do
|
|||
|
||||
def scope(conn), do: Philomena.ImageScope.scope(conn)
|
||||
|
||||
def anonymous_by_default?(conn) do
|
||||
conn.assigns.current_user.anonymous_by_default
|
||||
end
|
||||
|
||||
defp thumb_format("svg"), do: "png"
|
||||
defp thumb_format(format), do: format
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
defmodule PhilomenaWeb.Topic.PostView do
|
||||
use PhilomenaWeb, :view
|
||||
|
||||
def anonymous_by_default?(conn) do
|
||||
conn.assigns.current_user.anonymous_by_default
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
defmodule PhilomenaWeb.TopicView do
|
||||
use PhilomenaWeb, :view
|
||||
|
||||
def anonymous_by_default?(conn) do
|
||||
conn.assigns.current_user.anonymous_by_default
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue