mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-02 15:48:00 +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
|
.block__content.communication-edit__actions
|
||||||
=> submit "Post", class: "button"
|
=> submit "Post", class: "button"
|
||||||
= checkbox f, :anonymous
|
|
||||||
|
= if @conn.assigns.current_user do
|
||||||
|
= checkbox f, :anonymous, value: anonymous_by_default?(@conn)
|
||||||
= label f, :anonymous, "Anonymous"
|
= label f, :anonymous, "Anonymous"
|
|
@ -85,7 +85,7 @@
|
||||||
= if @conn.assigns.current_user do
|
= if @conn.assigns.current_user do
|
||||||
.field
|
.field
|
||||||
= label f, :anonymous, "Post anonymously"
|
= label f, :anonymous, "Post anonymously"
|
||||||
= checkbox f, :anonymous, class: "checkbox"
|
= checkbox f, :anonymous, class: "checkbox", value: anonymous_by_default?(@conn)
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= submit "Upload", class: "button", autocomplete: "off", data: [disable_with: "Please wait..."]
|
= submit "Upload", class: "button", autocomplete: "off", data: [disable_with: "Please wait..."]
|
|
@ -24,8 +24,9 @@
|
||||||
= 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
|
= 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
|
= error_tag fp, :body
|
||||||
|
|
||||||
|
= if @conn.assigns.current_user do
|
||||||
.field
|
.field
|
||||||
=> checkbox f, :anonymous
|
=> checkbox f, :anonymous, value: anonymous_by_default?(@conn)
|
||||||
= label f, :anonymous, "Post anonymously"
|
= label f, :anonymous, "Post anonymously"
|
||||||
|
|
||||||
= inputs_for f, :poll, fn fp ->
|
= inputs_for f, :poll, fn fp ->
|
||||||
|
|
|
@ -26,3 +26,7 @@
|
||||||
|
|
||||||
.block__content.communication-edit__actions
|
.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
|
defmodule PhilomenaWeb.Image.CommentView do
|
||||||
use PhilomenaWeb, :view
|
use PhilomenaWeb, :view
|
||||||
|
|
||||||
|
def anonymous_by_default?(conn) do
|
||||||
|
conn.assigns.current_user.anonymous_by_default
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -83,6 +83,10 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
|
|
||||||
def scope(conn), do: Philomena.ImageScope.scope(conn)
|
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("svg"), do: "png"
|
||||||
defp thumb_format(format), do: format
|
defp thumb_format(format), do: format
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
defmodule PhilomenaWeb.Topic.PostView do
|
defmodule PhilomenaWeb.Topic.PostView do
|
||||||
use PhilomenaWeb, :view
|
use PhilomenaWeb, :view
|
||||||
|
|
||||||
|
def anonymous_by_default?(conn) do
|
||||||
|
conn.assigns.current_user.anonymous_by_default
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
defmodule PhilomenaWeb.TopicView do
|
defmodule PhilomenaWeb.TopicView do
|
||||||
use PhilomenaWeb, :view
|
use PhilomenaWeb, :view
|
||||||
|
|
||||||
|
def anonymous_by_default?(conn) do
|
||||||
|
conn.assigns.current_user.anonymous_by_default
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue