From 4cfaf47573e72e3ff4a13aa21236615f49d9c327 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Fri, 15 Nov 2019 10:32:26 -0500 Subject: [PATCH] fix a few errors --- assets/js/resizablemedia.js | 2 +- config/dev.exs | 3 +++ lib/philomena/images/query.ex | 3 +++ lib/philomena/users/user.ex | 1 + lib/philomena_web/templates/layout/_header.html.slime | 7 +++++-- .../templates/pow/registration/edit.html.slime | 7 +++++-- .../pow_reset_password/reset_password/new.html.slime | 4 ++++ 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/assets/js/resizablemedia.js b/assets/js/resizablemedia.js index 4031cb75..36c1bee5 100644 --- a/assets/js/resizablemedia.js +++ b/assets/js/resizablemedia.js @@ -36,7 +36,7 @@ function applyMediaSize(container, size) { item.style.width = `${size}px`; item.style.height = `${size}px`; - const header = item.parentNode.childNodes[0]; + const header = item.parentNode.firstElementChild; // TODO: Make this proper and/or rethink this entire croc of bullshit item.parentNode.style.width = `${size}px`; /* When the large box has width less than mediaLargeMinSize, the header gets wrapped and occupies more than one line. diff --git a/config/dev.exs b/config/dev.exs index bf556820..a1c44c87 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -69,6 +69,9 @@ config :philomena, PhilomenaWeb.Mailer, config :philomena, :mailer_address, "noreply@philomena.lc" +# Use this to debug slime templates +# config :slime, :keep_lines, true + # Set a higher stacktrace during development. Avoid configuring such # in production as building large stacktraces may be expensive. config :phoenix, :stacktrace_depth, 20 diff --git a/lib/philomena/images/query.ex b/lib/philomena/images/query.ex index 0233874b..6bfb7f64 100644 --- a/lib/philomena/images/query.ex +++ b/lib/philomena/images/query.ex @@ -14,6 +14,9 @@ defmodule Philomena.Images.Query do def user_my_transform(%{user: %{id: id}}, "downvotes"), do: {:ok, %{term: %{downvoter_ids: id}}} + def user_my_transform(%{user: %{id: id}}, "uploads"), + do: {:ok, %{term: %{true_uploader_id: id}}} + def user_my_transform(%{watch: true}, "watched"), do: {:error, "Recursive watchlists are not allowed."} diff --git a/lib/philomena/users/user.ex b/lib/philomena/users/user.ex index 60fecd01..48177bbc 100644 --- a/lib/philomena/users/user.ex +++ b/lib/philomena/users/user.ex @@ -116,6 +116,7 @@ defmodule Philomena.Users.User do |> pow_extension_changeset(attrs) |> cast(attrs, []) |> validate_required([]) + |> unique_constraint(:email, name: :index_users_on_email) end def creation_changeset(user, attrs) do diff --git a/lib/philomena_web/templates/layout/_header.html.slime b/lib/philomena_web/templates/layout/_header.html.slime index 6165ec20..c06509a1 100644 --- a/lib/philomena_web/templates/layout/_header.html.slime +++ b/lib/philomena_web/templates/layout/_header.html.slime @@ -58,7 +58,7 @@ header.header i.fa.fa-fw.fa-comments> | Comments a.header__link href="/posts/posted" - i.fas.fa-fw.fa-pen-square> + i.fa.fa-fw.fa-pencil> | Posts a.header__link href='/user_links' i.fa.fa-fw.fa-link> @@ -69,8 +69,11 @@ header.header a.header__link href="/conversations" i.fa.fa-fw.fa-envelope> | Messages + a.header__link href=Routes.pow_registration_path(@conn, :edit) + i.fa.fa-fw.fa-user> + | Account a.header__link href="/session" data-method='delete' - i.fas.fa-fw.fa-sign-out-alt> + i.fa.fa-fw.fa-sign-out> | Logout - else a.header__link.hide-mobile href="/filters" diff --git a/lib/philomena_web/templates/pow/registration/edit.html.slime b/lib/philomena_web/templates/pow/registration/edit.html.slime index 8802cd8f..f0611102 100644 --- a/lib/philomena_web/templates/pow/registration/edit.html.slime +++ b/lib/philomena_web/templates/pow/registration/edit.html.slime @@ -11,9 +11,12 @@ p h3 API Key p ' Your API key is - code - => @current_user.authentication_token + code> + = @current_user.authentication_token ' - you can use this to allow API consumers to access your account. +p + ' Avoid sharing this key with others, as it could be used to compromise + ' your account. h3 Update Settings p diff --git a/lib/philomena_web/templates/pow_reset_password/reset_password/new.html.slime b/lib/philomena_web/templates/pow_reset_password/reset_password/new.html.slime index 72ec8a6c..c97c99dc 100644 --- a/lib/philomena_web/templates/pow_reset_password/reset_password/new.html.slime +++ b/lib/philomena_web/templates/pow_reset_password/reset_password/new.html.slime @@ -11,4 +11,8 @@ p .field = text_input f, :email, class: "input", placeholder: "Email" + .field + = checkbox f, :captcha, class: "js-captcha", value: 0 + = label f, :captcha, "I am not a robot!" + = submit "Submit", class: "button" \ No newline at end of file