Compare commits
No commits in common. "311579efd6b720ae48b2bb0ec4ccd62116b3462b" and "24f608163fb572690453649638cbf25005cf10fc" have entirely different histories.
311579efd6
...
24f608163f
14
.credo.exs
14
.credo.exs
@ -157,17 +157,17 @@
|
|||||||
#
|
#
|
||||||
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
|
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
|
||||||
#
|
#
|
||||||
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
|
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
|
||||||
{Credo.Check.Consistency.UnusedVariableNames, [force: :meaningful]},
|
{Credo.Check.Consistency.UnusedVariableNames, false},
|
||||||
{Credo.Check.Design.DuplicatedCode, false},
|
{Credo.Check.Design.DuplicatedCode, false},
|
||||||
{Credo.Check.Readability.AliasAs, false},
|
{Credo.Check.Readability.AliasAs, false},
|
||||||
{Credo.Check.Readability.BlockPipe, false},
|
{Credo.Check.Readability.BlockPipe, false},
|
||||||
{Credo.Check.Readability.ImplTrue, false},
|
{Credo.Check.Readability.ImplTrue, false},
|
||||||
{Credo.Check.Readability.MultiAlias, false},
|
{Credo.Check.Readability.MultiAlias, false},
|
||||||
{Credo.Check.Readability.SeparateAliasRequire, []},
|
{Credo.Check.Readability.SeparateAliasRequire, false},
|
||||||
{Credo.Check.Readability.SinglePipe, false},
|
{Credo.Check.Readability.SinglePipe, false},
|
||||||
{Credo.Check.Readability.Specs, false},
|
{Credo.Check.Readability.Specs, false},
|
||||||
{Credo.Check.Readability.StrictModuleLayout, []},
|
{Credo.Check.Readability.StrictModuleLayout, false},
|
||||||
{Credo.Check.Readability.WithCustomTaggedTuple, false},
|
{Credo.Check.Readability.WithCustomTaggedTuple, false},
|
||||||
{Credo.Check.Refactor.ABCSize, false},
|
{Credo.Check.Refactor.ABCSize, false},
|
||||||
{Credo.Check.Refactor.AppendSingleItem, false},
|
{Credo.Check.Refactor.AppendSingleItem, false},
|
||||||
@ -176,9 +176,9 @@
|
|||||||
{Credo.Check.Refactor.NegatedIsNil, false},
|
{Credo.Check.Refactor.NegatedIsNil, false},
|
||||||
{Credo.Check.Refactor.PipeChainStart, false},
|
{Credo.Check.Refactor.PipeChainStart, false},
|
||||||
{Credo.Check.Refactor.VariableRebinding, false},
|
{Credo.Check.Refactor.VariableRebinding, false},
|
||||||
{Credo.Check.Warning.LeakyEnvironment, []},
|
{Credo.Check.Warning.LeakyEnvironment, false},
|
||||||
{Credo.Check.Warning.MapGetUnsafePass, []},
|
{Credo.Check.Warning.MapGetUnsafePass, false},
|
||||||
{Credo.Check.Warning.UnsafeToAtom, []}
|
{Credo.Check.Warning.UnsafeToAtom, false}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Custom checks can be created using `mix credo.gen.check`.
|
# Custom checks can be created using `mix credo.gen.check`.
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
# v0.1.8
|
|
||||||
- Fix bug with public registration
|
|
||||||
- Improve templates
|
|
||||||
- Improve invites, record usage
|
|
||||||
- Fix padding on more pages when using chrome
|
|
||||||
- Add oban metrics to server log and live dashboard
|
|
||||||
|
|
||||||
# v0.1.7
|
# v0.1.7
|
||||||
- Update dependencies
|
- Update dependencies
|
||||||
- Show topbar on form submit/page refresh
|
- Show topbar on form submit/page refresh
|
||||||
|
@ -11,8 +11,6 @@ config :memex,
|
|||||||
ecto_repos: [Memex.Repo],
|
ecto_repos: [Memex.Repo],
|
||||||
generators: [binary_id: true]
|
generators: [binary_id: true]
|
||||||
|
|
||||||
config :memex, Memex.Accounts, registration: System.get_env("REGISTRATION", "invite")
|
|
||||||
|
|
||||||
# Configures the endpoint
|
# Configures the endpoint
|
||||||
config :memex, MemexWeb.Endpoint,
|
config :memex, MemexWeb.Endpoint,
|
||||||
url: [scheme: "https", host: System.get_env("HOST") || "localhost", port: "443"],
|
url: [scheme: "https", host: System.get_env("HOST") || "localhost", port: "443"],
|
||||||
@ -20,7 +18,8 @@ config :memex, MemexWeb.Endpoint,
|
|||||||
secret_key_base: "KH59P0iZixX5gP/u+zkxxG8vAAj6vgt0YqnwEB5JP5K+E567SsqkCz69uWShjE7I",
|
secret_key_base: "KH59P0iZixX5gP/u+zkxxG8vAAj6vgt0YqnwEB5JP5K+E567SsqkCz69uWShjE7I",
|
||||||
render_errors: [view: MemexWeb.ErrorView, accepts: ~w(html json), layout: false],
|
render_errors: [view: MemexWeb.ErrorView, accepts: ~w(html json), layout: false],
|
||||||
pubsub_server: Memex.PubSub,
|
pubsub_server: Memex.PubSub,
|
||||||
live_view: [signing_salt: "zOLgd3lr"]
|
live_view: [signing_salt: "zOLgd3lr"],
|
||||||
|
registration: System.get_env("REGISTRATION") || "invite"
|
||||||
|
|
||||||
config :memex, Memex.Application, automigrate: false
|
config :memex, Memex.Application, automigrate: false
|
||||||
|
|
||||||
|
@ -64,9 +64,8 @@ config :memex, MemexWeb.Endpoint,
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
config :logger, :console,
|
# Do not include metadata nor timestamps in development logs
|
||||||
format: "[$level] $message $metadata\n\n",
|
config :logger, :console, format: "[$level] $message\n"
|
||||||
metadata: [:data]
|
|
||||||
|
|
||||||
# Set a higher stacktrace during development. Avoid configuring such
|
# Set a higher stacktrace during development. Avoid configuring such
|
||||||
# in production as building large stacktraces may be expensive.
|
# in production as building large stacktraces may be expensive.
|
||||||
|
@ -42,8 +42,6 @@ config :memex, Memex.Repo,
|
|||||||
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
|
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
|
||||||
socket_options: maybe_ipv6
|
socket_options: maybe_ipv6
|
||||||
|
|
||||||
config :memex, Memex.Accounts, registration: System.get_env("REGISTRATION", "invite")
|
|
||||||
|
|
||||||
config :memex, MemexWeb.Endpoint,
|
config :memex, MemexWeb.Endpoint,
|
||||||
url: [scheme: "https", host: host, port: 443],
|
url: [scheme: "https", host: host, port: 443],
|
||||||
http: [
|
http: [
|
||||||
@ -52,7 +50,8 @@ config :memex, MemexWeb.Endpoint,
|
|||||||
ip: interface,
|
ip: interface,
|
||||||
port: String.to_integer(System.get_env("PORT", "4000"))
|
port: String.to_integer(System.get_env("PORT", "4000"))
|
||||||
],
|
],
|
||||||
server: true
|
server: true,
|
||||||
|
registration: System.get_env("REGISTRATION", "invite")
|
||||||
|
|
||||||
if config_env() == :prod do
|
if config_env() == :prod do
|
||||||
# The secret key base is used to sign/encrypt cookies and other secrets.
|
# The secret key base is used to sign/encrypt cookies and other secrets.
|
||||||
|
@ -5,7 +5,7 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
alias Memex.{Mailer, Repo}
|
alias Memex.{Mailer, Repo}
|
||||||
alias Memex.Accounts.{Invite, Invites, User, UserToken}
|
alias Memex.Accounts.{User, UserToken}
|
||||||
alias Ecto.{Changeset, Multi}
|
alias Ecto.{Changeset, Multi}
|
||||||
alias Oban.Job
|
alias Oban.Job
|
||||||
|
|
||||||
@ -16,27 +16,23 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> get_user_by_email("foo@example.com")
|
||||||
iex> with %User{} <- get_user_by_email("foo@example.com"), do: :passed
|
%User{}
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> get_user_by_email("unknown@example.com")
|
iex> get_user_by_email("unknown@example.com")
|
||||||
nil
|
nil
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec get_user_by_email(email :: String.t()) :: User.t() | nil
|
@spec get_user_by_email(email :: String.t()) :: User.t() | nil
|
||||||
def get_user_by_email(email) when is_binary(email) do
|
def get_user_by_email(email) when is_binary(email), do: Repo.get_by(User, email: email)
|
||||||
Repo.get_by(User, email: email)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets a user by email and password.
|
Gets a user by email and password.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> get_user_by_email_and_password("foo@example.com", "correct_password")
|
||||||
iex> with %User{} <- get_user_by_email_and_password("foo@example.com", "valid_password"), do: :passed
|
%User{}
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> get_user_by_email_and_password("foo@example.com", "invalid_password")
|
iex> get_user_by_email_and_password("foo@example.com", "invalid_password")
|
||||||
nil
|
nil
|
||||||
@ -57,33 +53,28 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> get_user!(123)
|
||||||
iex> get_user!(user.id)
|
%User{}
|
||||||
user
|
|
||||||
|
|
||||||
> get_user!()
|
iex> get_user!(456)
|
||||||
** (Ecto.NoResultsError)
|
** (Ecto.NoResultsError)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec get_user!(User.t()) :: User.t()
|
@spec get_user!(User.t()) :: User.t()
|
||||||
def get_user!(id) do
|
def get_user!(id), do: Repo.get!(User, id)
|
||||||
Repo.get!(User, id)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns all users grouped by role.
|
Returns all users grouped by role.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user1} = register_user(%{email: "foo1@example.com", password: "valid_password"})
|
iex> list_users_by_role(%User{id: 123, role: :admin})
|
||||||
iex> {:ok, user2} = register_user(%{email: "foo2@example.com", password: "valid_password"})
|
[admin: [%User{}], user: [%User{}, %User{}]]
|
||||||
iex> with %{admin: [^user1], user: [^user2]} <- list_all_users_by_role(user1), do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec list_all_users_by_role(User.t()) :: %{User.role() => [User.t()]}
|
@spec list_all_users_by_role(User.t()) :: %{String.t() => [User.t()]}
|
||||||
def list_all_users_by_role(%User{role: :admin}) do
|
def list_all_users_by_role(%User{role: :admin}) do
|
||||||
Repo.all(from u in User, order_by: u.email) |> Enum.group_by(fn %{role: role} -> role end)
|
Repo.all(from u in User, order_by: u.email) |> Enum.group_by(fn user -> user.role end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -91,13 +82,13 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> list_users_by_role(%User{id: 123, role: :admin})
|
||||||
iex> with [^user] <- list_users_by_role(:admin), do: :passed
|
[%User{}]
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec list_users_by_role(:admin) :: [User.t()]
|
@spec list_users_by_role(User.role()) :: [User.t()]
|
||||||
def list_users_by_role(:admin = role) do
|
def list_users_by_role(role) do
|
||||||
|
role = role |> to_string()
|
||||||
Repo.all(from u in User, where: u.role == ^role, order_by: u.email)
|
Repo.all(from u in User, where: u.role == ^role, order_by: u.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -108,36 +99,26 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> with {:ok, %User{email: "foo@example.com"}} <-
|
iex> register_user(%{field: value})
|
||||||
...> register_user(%{email: "foo@example.com", password: "valid_password"}),
|
{:ok, %User{}}
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> with {:error, %Changeset{}} <- register_user(%{email: "foo@example"}), do: :passed
|
iex> register_user(%{field: bad_value})
|
||||||
:passed
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec register_user(attrs :: map(), Invite.token() | nil) ::
|
@spec register_user(attrs :: map()) :: {:ok, User.t()} | {:error, User.changeset()}
|
||||||
{:ok, User.t()} | {:error, :invalid_token | User.changeset()}
|
def register_user(attrs) do
|
||||||
def register_user(attrs, invite_token \\ nil) do
|
|
||||||
Multi.new()
|
Multi.new()
|
||||||
|> Multi.one(:users_count, from(u in User, select: count(u.id), distinct: true))
|
|> Multi.one(:users_count, from(u in User, select: count(u.id), distinct: true))
|
||||||
|> Multi.run(:use_invite, fn _changes_so_far, _repo ->
|
|> Multi.insert(:add_user, fn %{users_count: count} ->
|
||||||
if allow_registration?() and invite_token |> is_nil() do
|
|
||||||
{:ok, nil}
|
|
||||||
else
|
|
||||||
Invites.use_invite(invite_token)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|> Multi.insert(:add_user, fn %{users_count: count, use_invite: invite} ->
|
|
||||||
# if no registered users, make first user an admin
|
# if no registered users, make first user an admin
|
||||||
role = if count == 0, do: :admin, else: :user
|
role = if count == 0, do: :admin, else: :user
|
||||||
User.registration_changeset(attrs, invite) |> User.role_changeset(role)
|
|
||||||
|
User.registration_changeset(attrs) |> User.role_changeset(role)
|
||||||
end)
|
end)
|
||||||
|> Repo.transaction()
|
|> Repo.transaction()
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{add_user: user}} -> {:ok, user}
|
{:ok, %{add_user: user}} -> {:ok, user}
|
||||||
{:error, :use_invite, :invalid_token, _changes_so_far} -> {:error, :invalid_token}
|
|
||||||
{:error, :add_user, changeset, _changes_so_far} -> {:error, changeset}
|
{:error, :add_user, changeset, _changes_so_far} -> {:error, changeset}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -147,18 +128,14 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> with %Changeset{} <- change_user_registration(), do: :passed
|
iex> change_user_registration(user)
|
||||||
:passed
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
iex> with %Changeset{} <- change_user_registration(%{password: "hi"}), do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_registration() :: User.changeset()
|
@spec change_user_registration() :: User.changeset()
|
||||||
@spec change_user_registration(attrs :: map()) :: User.changeset()
|
@spec change_user_registration(attrs :: map()) :: User.changeset()
|
||||||
def change_user_registration(attrs \\ %{}) do
|
def change_user_registration(attrs \\ %{}),
|
||||||
User.registration_changeset(attrs, nil, hash_password: false)
|
do: User.registration_changeset(attrs, hash_password: false)
|
||||||
end
|
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
@ -167,29 +144,24 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> with %Changeset{} <- change_user_email(%User{email: "foo@example.com"}), do: :passed
|
iex> change_user_email(user)
|
||||||
:passed
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_email(User.t()) :: User.changeset()
|
|
||||||
@spec change_user_email(User.t(), attrs :: map()) :: User.changeset()
|
@spec change_user_email(User.t(), attrs :: map()) :: User.changeset()
|
||||||
def change_user_email(user, attrs \\ %{}) do
|
def change_user_email(user, attrs \\ %{}), do: User.email_changeset(user, attrs)
|
||||||
User.email_changeset(user, attrs)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns an `%Changeset{}` for changing the user role.
|
Returns an `%Changeset{}` for changing the user role.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> with %Changeset{} <- change_user_role(%User{}, :user), do: :passed
|
iex> change_user_role(user)
|
||||||
:passed
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_role(User.t(), User.role()) :: User.changeset()
|
@spec change_user_role(User.t(), User.role()) :: User.changeset()
|
||||||
def change_user_role(user, role) do
|
def change_user_role(user, role), do: User.role_changeset(user, role)
|
||||||
User.role_changeset(user, role)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Emulates that the email will change without actually changing
|
Emulates that the email will change without actually changing
|
||||||
@ -197,20 +169,14 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> apply_user_email(user, "valid password", %{email: ...})
|
||||||
iex> with {:ok, %User{}} <-
|
{:ok, %User{}}
|
||||||
...> apply_user_email(user, "valid_password", %{email: "new_email@account.com"}),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> apply_user_email(user, "invalid password", %{email: ...})
|
||||||
iex> with {:error, %Changeset{}} <-
|
{:error, %Changeset{}}
|
||||||
...> apply_user_email(user, "invalid password", %{email: "new_email@account"}),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec apply_user_email(User.t(), email :: String.t(), attrs :: map()) ::
|
@spec apply_user_email(User.t(), password :: String.t(), attrs :: map()) ::
|
||||||
{:ok, User.t()} | {:error, User.changeset()}
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def apply_user_email(user, password, attrs) do
|
def apply_user_email(user, password, attrs) do
|
||||||
user
|
user
|
||||||
@ -234,7 +200,7 @@ defmodule Memex.Accounts do
|
|||||||
{:ok, _} <- Repo.transaction(user_email_multi(user, email, context)) do
|
{:ok, _} <- Repo.transaction(user_email_multi(user, email, context)) do
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
_error_tuple -> :error
|
_ -> :error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -252,12 +218,8 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, %{id: user_id} = user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> deliver_update_email_instructions(user, current_email, &Routes.user_update_email_url(conn, :edit, &1))
|
||||||
iex> with %Oban.Job{
|
{:ok, %{to: ..., body: ...}}
|
||||||
...> args: %{email: :update_email, user_id: ^user_id, attrs: %{url: "example url"}}
|
|
||||||
...> } <- deliver_update_email_instructions(user, "new_foo@example.com", fn _token -> "example url" end),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec deliver_update_email_instructions(User.t(), current_email :: String.t(), function) ::
|
@spec deliver_update_email_instructions(User.t(), current_email :: String.t(), function) ::
|
||||||
@ -274,37 +236,27 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> with %Changeset{} <- change_user_password(%User{}), do: :passed
|
iex> change_user_password(user)
|
||||||
:passed
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_password(User.t(), attrs :: map()) :: User.changeset()
|
@spec change_user_password(User.t(), attrs :: map()) :: User.changeset()
|
||||||
def change_user_password(user, attrs \\ %{}) do
|
def change_user_password(user, attrs \\ %{}),
|
||||||
User.password_changeset(user, attrs, hash_password: false)
|
do: User.password_changeset(user, attrs, hash_password: false)
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Updates the user password.
|
Updates the user password.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> update_user_password(user, "valid password", %{password: ...})
|
||||||
iex> with {:ok, %User{}} <-
|
{:ok, %User{}}
|
||||||
...> reset_user_password(user, %{
|
|
||||||
...> password: "new password",
|
|
||||||
...> password_confirmation: "new password"
|
|
||||||
...> }),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> update_user_password(user, "invalid password", %{password: ...})
|
||||||
iex> with {:error, %Changeset{}} <-
|
{:error, %Changeset{}}
|
||||||
...> update_user_password(user, "invalid password", %{password: "123"}),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_user_password(User.t(), String.t(), attrs :: map()) ::
|
@spec update_user_password(User.t(), password :: String.t(), attrs :: map()) ::
|
||||||
{:ok, User.t()} | {:error, User.changeset()}
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def update_user_password(user, password, attrs) do
|
def update_user_password(user, password, attrs) do
|
||||||
changeset =
|
changeset =
|
||||||
@ -318,62 +270,54 @@ defmodule Memex.Accounts do
|
|||||||
|> Repo.transaction()
|
|> Repo.transaction()
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{user: user}} -> {:ok, user}
|
{:ok, %{user: user}} -> {:ok, user}
|
||||||
{:error, :user, changeset, _changes_so_far} -> {:error, changeset}
|
{:error, :user, changeset, _} -> {:error, changeset}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns an `Ecto.Changeset.t()` for changing the user locale.
|
Returns an `%Changeset{}` for changing the user locale.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> with %Changeset{} <- change_user_locale(%User{}), do: :passed
|
iex> change_user_locale(user)
|
||||||
:passed
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_locale(User.t()) :: User.changeset()
|
@spec change_user_locale(User.t()) :: User.changeset()
|
||||||
def change_user_locale(%{locale: locale} = user) do
|
def change_user_locale(%{locale: locale} = user), do: User.locale_changeset(user, locale)
|
||||||
User.locale_changeset(user, locale)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Updates the user locale.
|
Updates the user locale.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> update_user_locale(user, "valid locale")
|
||||||
iex> with {:ok, %User{}} <- update_user_locale(user, "en_US"), do: :passed
|
{:ok, %User{}}
|
||||||
:passed
|
|
||||||
|
iex> update_user_password(user, "invalid locale")
|
||||||
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_user_locale(User.t(), locale :: String.t()) ::
|
@spec update_user_locale(User.t(), locale :: String.t()) ::
|
||||||
{:ok, User.t()} | {:error, User.changeset()}
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def update_user_locale(user, locale) do
|
def update_user_locale(user, locale),
|
||||||
user |> User.locale_changeset(locale) |> Repo.update()
|
do: user |> User.locale_changeset(locale) |> Repo.update()
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Deletes a user. must be performed by an admin or the same user!
|
Deletes a user. must be performed by an admin or the same user!
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> delete_user!(user_to_delete, %User{id: 123, role: :admin})
|
||||||
iex> with %User{} <- delete_user!(user, %User{id: 123, role: :admin}), do: :passed
|
%User{}
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> delete_user!(%User{id: 123}, %User{id: 123})
|
||||||
iex> with %User{} <- delete_user!(user, user), do: :passed
|
%User{}
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_user!(user_to_delete :: User.t(), User.t()) :: User.t()
|
@spec delete_user!(user_to_delete :: User.t(), User.t()) :: User.t()
|
||||||
def delete_user!(user, %User{role: :admin}) do
|
def delete_user!(user, %User{role: :admin}), do: user |> Repo.delete!()
|
||||||
user |> Repo.delete!()
|
def delete_user!(%User{id: user_id} = user, %User{id: user_id}), do: user |> Repo.delete!()
|
||||||
end
|
|
||||||
|
|
||||||
def delete_user!(%User{id: user_id} = user, %User{id: user_id}) do
|
|
||||||
user |> Repo.delete!()
|
|
||||||
end
|
|
||||||
|
|
||||||
## Session
|
## Session
|
||||||
|
|
||||||
@ -401,7 +345,7 @@ defmodule Memex.Accounts do
|
|||||||
"""
|
"""
|
||||||
@spec delete_session_token(token :: String.t()) :: :ok
|
@spec delete_session_token(token :: String.t()) :: :ok
|
||||||
def delete_session_token(token) do
|
def delete_session_token(token) do
|
||||||
UserToken.token_and_context_query(token, "session") |> Repo.delete_all()
|
Repo.delete_all(UserToken.token_and_context_query(token, "session"))
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -410,40 +354,20 @@ defmodule Memex.Accounts do
|
|||||||
"""
|
"""
|
||||||
@spec allow_registration?() :: boolean()
|
@spec allow_registration?() :: boolean()
|
||||||
def allow_registration? do
|
def allow_registration? do
|
||||||
Application.get_env(:memex, Memex.Accounts)[:registration] == "public" or
|
Application.get_env(:memex, MemexWeb.Endpoint)[:registration] == "public" or
|
||||||
list_users_by_role(:admin) |> Enum.empty?()
|
list_users_by_role(:admin) |> Enum.empty?()
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Checks if user is an admin
|
Checks if user is an admin
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
|
||||||
iex> is_admin?(user)
|
|
||||||
true
|
|
||||||
|
|
||||||
iex> is_admin?(%User{id: Ecto.UUID.generate()})
|
|
||||||
false
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec is_admin?(User.t()) :: boolean()
|
@spec is_admin?(User.t()) :: boolean()
|
||||||
def is_admin?(%User{id: user_id}) do
|
def is_admin?(%User{id: user_id}) do
|
||||||
Repo.exists?(from u in User, where: u.id == ^user_id, where: u.role == :admin)
|
Repo.exists?(from u in User, where: u.id == ^user_id and u.role == :admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Checks to see if user has the admin role
|
Checks to see if user has the admin role
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
|
||||||
iex> is_already_admin?(user)
|
|
||||||
true
|
|
||||||
|
|
||||||
iex> is_already_admin?(%User{})
|
|
||||||
false
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec is_already_admin?(User.t() | nil) :: boolean()
|
@spec is_already_admin?(User.t() | nil) :: boolean()
|
||||||
def is_already_admin?(%User{role: :admin}), do: true
|
def is_already_admin?(%User{role: :admin}), do: true
|
||||||
@ -456,16 +380,10 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, %{id: user_id} = user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> deliver_user_confirmation_instructions(user, &Routes.user_confirmation_url(conn, :confirm, &1))
|
||||||
iex> with %Oban.Job{
|
{:ok, %{to: ..., body: ...}}
|
||||||
...> args: %{email: :welcome, user_id: ^user_id, attrs: %{url: "example url"}}
|
|
||||||
...> } <- deliver_user_confirmation_instructions(user, fn _token -> "example url" end),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> deliver_user_confirmation_instructions(confirmed_user, &Routes.user_confirmation_url(conn, :confirm, &1))
|
||||||
iex> user = user |> User.confirm_changeset() |> Repo.update!()
|
|
||||||
iex> deliver_user_confirmation_instructions(user, fn _token -> "example url" end)
|
|
||||||
{:error, :already_confirmed}
|
{:error, :already_confirmed}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -487,14 +405,14 @@ defmodule Memex.Accounts do
|
|||||||
If the token matches, the user account is marked as confirmed
|
If the token matches, the user account is marked as confirmed
|
||||||
and the token is deleted.
|
and the token is deleted.
|
||||||
"""
|
"""
|
||||||
@spec confirm_user(token :: String.t()) :: {:ok, User.t()} | :error
|
@spec confirm_user(token :: String.t()) :: {:ok, User.t()} | atom()
|
||||||
def confirm_user(token) do
|
def confirm_user(token) do
|
||||||
with {:ok, query} <- UserToken.verify_email_token_query(token, "confirm"),
|
with {:ok, query} <- UserToken.verify_email_token_query(token, "confirm"),
|
||||||
%User{} = user <- Repo.one(query),
|
%User{} = user <- Repo.one(query),
|
||||||
{:ok, %{user: user}} <- Repo.transaction(confirm_user_multi(user)) do
|
{:ok, %{user: user}} <- Repo.transaction(confirm_user_multi(user)) do
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
else
|
else
|
||||||
_error_tuple -> :error
|
_ -> :error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -512,12 +430,8 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, %{id: user_id} = user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> deliver_user_reset_password_instructions(user, &Routes.user_reset_password_url(conn, :edit, &1))
|
||||||
iex> with %Oban.Job{args: %{
|
{:ok, %{to: ..., body: ...}}
|
||||||
...> email: :reset_password, user_id: ^user_id, attrs: %{url: "example url"}}
|
|
||||||
...> } <- deliver_user_reset_password_instructions(user, fn _token -> "example url" end),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec deliver_user_reset_password_instructions(User.t(), function()) :: Job.t()
|
@spec deliver_user_reset_password_instructions(User.t(), function()) :: Job.t()
|
||||||
@ -533,11 +447,8 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> get_user_by_reset_password_token("validtoken")
|
||||||
iex> {encoded_token, user_token} = UserToken.build_email_token(user, "reset_password")
|
%User{}
|
||||||
iex> Repo.insert!(user_token)
|
|
||||||
iex> with %User{} <- get_user_by_reset_password_token(encoded_token), do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> get_user_by_reset_password_token("invalidtoken")
|
iex> get_user_by_reset_password_token("invalidtoken")
|
||||||
nil
|
nil
|
||||||
@ -549,7 +460,7 @@ defmodule Memex.Accounts do
|
|||||||
%User{} = user <- Repo.one(query) do
|
%User{} = user <- Repo.one(query) do
|
||||||
user
|
user
|
||||||
else
|
else
|
||||||
_error_tuple -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -558,20 +469,11 @@ defmodule Memex.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> reset_user_password(user, %{password: "new long password", password_confirmation: "new long password"})
|
||||||
iex> with {:ok, %User{}} <-
|
{:ok, %User{}}
|
||||||
...> reset_user_password(user, %{
|
|
||||||
...> password: "new password",
|
|
||||||
...> password_confirmation: "new password"
|
|
||||||
...> }),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
iex> {:ok, user} = register_user(%{email: "foo@example.com", password: "valid_password"})
|
iex> reset_user_password(user, %{password: "valid", password_confirmation: "not the same"})
|
||||||
iex> with {:error, %Changeset{}} <-
|
{:error, %Changeset{}}
|
||||||
...> reset_user_password(user, %{password: "valid", password_confirmation: "not the same"}),
|
|
||||||
...> do: :passed
|
|
||||||
:passed
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec reset_user_password(User.t(), attrs :: map()) ::
|
@spec reset_user_password(User.t(), attrs :: map()) ::
|
||||||
@ -583,7 +485,7 @@ defmodule Memex.Accounts do
|
|||||||
|> Repo.transaction()
|
|> Repo.transaction()
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{user: user}} -> {:ok, user}
|
{:ok, %{user: user}} -> {:ok, user}
|
||||||
{:error, :user, changeset, _changes_so_far} -> {:error, changeset}
|
{:error, :user, changeset, _} -> {:error, changeset}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,196 +0,0 @@
|
|||||||
defmodule Memex.Accounts.Invites do
|
|
||||||
@moduledoc """
|
|
||||||
The Invites context.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import Ecto.Query, warn: false
|
|
||||||
alias Ecto.Multi
|
|
||||||
alias Memex.Accounts.{Invite, User}
|
|
||||||
alias Memex.Repo
|
|
||||||
|
|
||||||
@invite_token_length 20
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Returns the list of invites.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> list_invites(%User{id: 123, role: :admin})
|
|
||||||
[%Invite{}, ...]
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec list_invites(User.t()) :: [Invite.t()]
|
|
||||||
def list_invites(%User{role: :admin}) do
|
|
||||||
Repo.all(from i in Invite, order_by: i.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Gets a single invite for a user
|
|
||||||
|
|
||||||
Raises `Ecto.NoResultsError` if the Invite does not exist.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> get_invite!(123, %User{id: 123, role: :admin})
|
|
||||||
%Invite{}
|
|
||||||
|
|
||||||
> get_invite!(456, %User{id: 123, role: :admin})
|
|
||||||
** (Ecto.NoResultsError)
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec get_invite!(Invite.id(), User.t()) :: Invite.t()
|
|
||||||
def get_invite!(id, %User{role: :admin}) do
|
|
||||||
Repo.get!(Invite, id)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Returns if an invite token is still valid
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> valid_invite_token?("valid_token")
|
|
||||||
%Invite{}
|
|
||||||
|
|
||||||
iex> valid_invite_token?("invalid_token")
|
|
||||||
nil
|
|
||||||
"""
|
|
||||||
@spec valid_invite_token?(Invite.token() | nil) :: boolean()
|
|
||||||
def valid_invite_token?(token) when token in [nil, ""], do: false
|
|
||||||
|
|
||||||
def valid_invite_token?(token) do
|
|
||||||
Repo.exists?(
|
|
||||||
from i in Invite,
|
|
||||||
where: i.token == ^token,
|
|
||||||
where: i.disabled_at |> is_nil()
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Uses invite by decrementing uses_left, or marks invite invalid if it's been
|
|
||||||
completely used.
|
|
||||||
"""
|
|
||||||
@spec use_invite(Invite.token()) :: {:ok, Invite.t()} | {:error, :invalid_token}
|
|
||||||
def use_invite(invite_token) do
|
|
||||||
Multi.new()
|
|
||||||
|> Multi.run(:invite, fn _changes_so_far, _repo ->
|
|
||||||
invite_token |> get_invite_by_token()
|
|
||||||
end)
|
|
||||||
|> Multi.update(:decrement_invite, fn %{invite: invite} ->
|
|
||||||
decrement_invite_changeset(invite)
|
|
||||||
end)
|
|
||||||
|> Repo.transaction()
|
|
||||||
|> case do
|
|
||||||
{:ok, %{decrement_invite: invite}} -> {:ok, invite}
|
|
||||||
{:error, :invite, :invalid_token, _changes_so_far} -> {:error, :invalid_token}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec get_invite_by_token(Invite.token()) :: {:ok, Invite.t()} | {:error, :invalid_token}
|
|
||||||
defp get_invite_by_token(token) do
|
|
||||||
Repo.one(
|
|
||||||
from i in Invite,
|
|
||||||
where: i.token == ^token,
|
|
||||||
where: i.disabled_at |> is_nil()
|
|
||||||
)
|
|
||||||
|> case do
|
|
||||||
nil -> {:error, :invalid_token}
|
|
||||||
invite -> {:ok, invite}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec get_use_count(Invite.t(), User.t()) :: non_neg_integer()
|
|
||||||
def get_use_count(%Invite{id: invite_id}, %User{role: :admin}) do
|
|
||||||
Repo.one(
|
|
||||||
from u in User,
|
|
||||||
where: u.invite_id == ^invite_id,
|
|
||||||
select: count(u.id)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec decrement_invite_changeset(Invite.t()) :: Invite.changeset()
|
|
||||||
defp decrement_invite_changeset(%Invite{uses_left: nil} = invite) do
|
|
||||||
invite |> Invite.update_changeset(%{})
|
|
||||||
end
|
|
||||||
|
|
||||||
defp decrement_invite_changeset(%Invite{uses_left: 1} = invite) do
|
|
||||||
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
|
||||||
invite |> Invite.update_changeset(%{uses_left: 0, disabled_at: now})
|
|
||||||
end
|
|
||||||
|
|
||||||
defp decrement_invite_changeset(%Invite{uses_left: uses_left} = invite) do
|
|
||||||
invite |> Invite.update_changeset(%{uses_left: uses_left - 1})
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Creates a invite.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> create_invite(%User{id: 123, role: :admin}, %{field: value})
|
|
||||||
{:ok, %Invite{}}
|
|
||||||
|
|
||||||
iex> create_invite(%User{id: 123, role: :admin}, %{field: bad_value})
|
|
||||||
{:error, %Changeset{}}
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec create_invite(User.t(), attrs :: map()) ::
|
|
||||||
{:ok, Invite.t()} | {:error, Invite.changeset()}
|
|
||||||
def create_invite(%User{role: :admin} = user, attrs) do
|
|
||||||
token =
|
|
||||||
:crypto.strong_rand_bytes(@invite_token_length)
|
|
||||||
|> Base.url_encode64()
|
|
||||||
|> binary_part(0, @invite_token_length)
|
|
||||||
|
|
||||||
Invite.create_changeset(user, token, attrs) |> Repo.insert()
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Updates a invite.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> update_invite(invite, %{field: new_value}, %User{id: 123, role: :admin})
|
|
||||||
{:ok, %Invite{}}
|
|
||||||
|
|
||||||
iex> update_invite(invite, %{field: bad_value}, %User{id: 123, role: :admin})
|
|
||||||
{:error, %Changeset{}}
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec update_invite(Invite.t(), attrs :: map(), User.t()) ::
|
|
||||||
{:ok, Invite.t()} | {:error, Invite.changeset()}
|
|
||||||
def update_invite(invite, attrs, %User{role: :admin}) do
|
|
||||||
invite |> Invite.update_changeset(attrs) |> Repo.update()
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Deletes a invite.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> delete_invite(invite, %User{id: 123, role: :admin})
|
|
||||||
{:ok, %Invite{}}
|
|
||||||
|
|
||||||
iex> delete_invite(invite, %User{id: 123, role: :admin})
|
|
||||||
{:error, %Changeset{}}
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec delete_invite(Invite.t(), User.t()) ::
|
|
||||||
{:ok, Invite.t()} | {:error, Invite.changeset()}
|
|
||||||
def delete_invite(invite, %User{role: :admin}) do
|
|
||||||
invite |> Repo.delete()
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Deletes a invite.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
iex> delete_invite(invite, %User{id: 123, role: :admin})
|
|
||||||
%Invite{}
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec delete_invite!(Invite.t(), User.t()) :: Invite.t()
|
|
||||||
def delete_invite!(invite, %User{role: :admin}) do
|
|
||||||
invite |> Repo.delete!()
|
|
||||||
end
|
|
||||||
end
|
|
@ -6,8 +6,8 @@ defmodule Memex.Accounts.User do
|
|||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
import MemexWeb.Gettext
|
import MemexWeb.Gettext
|
||||||
alias Ecto.{Association, Changeset, UUID}
|
alias Ecto.{Changeset, UUID}
|
||||||
alias Memex.Accounts.{Invite, User}
|
alias Memex.Invites.Invite
|
||||||
|
|
||||||
@derive {Jason.Encoder,
|
@derive {Jason.Encoder,
|
||||||
only: [
|
only: [
|
||||||
@ -30,31 +30,27 @@ defmodule Memex.Accounts.User do
|
|||||||
field :role, Ecto.Enum, values: [:admin, :user], default: :user
|
field :role, Ecto.Enum, values: [:admin, :user], default: :user
|
||||||
field :locale, :string
|
field :locale, :string
|
||||||
|
|
||||||
has_many :created_invites, Invite, foreign_key: :created_by_id
|
has_many :invites, Invite, on_delete: :delete_all
|
||||||
|
|
||||||
belongs_to :invite, Invite
|
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
@type t :: %User{
|
@type t :: %__MODULE__{
|
||||||
id: id(),
|
id: id(),
|
||||||
email: String.t(),
|
email: String.t(),
|
||||||
password: String.t(),
|
password: String.t(),
|
||||||
hashed_password: String.t(),
|
hashed_password: String.t(),
|
||||||
confirmed_at: NaiveDateTime.t(),
|
confirmed_at: NaiveDateTime.t(),
|
||||||
role: role(),
|
role: role(),
|
||||||
|
invites: [Invite.t()],
|
||||||
locale: String.t() | nil,
|
locale: String.t() | nil,
|
||||||
created_invites: [Invite.t()] | Association.NotLoaded.t(),
|
|
||||||
invite: Invite.t() | nil | Association.NotLoaded.t(),
|
|
||||||
invite_id: Invite.id() | nil,
|
|
||||||
inserted_at: NaiveDateTime.t(),
|
inserted_at: NaiveDateTime.t(),
|
||||||
updated_at: NaiveDateTime.t()
|
updated_at: NaiveDateTime.t()
|
||||||
}
|
}
|
||||||
@type new_user :: %User{}
|
@type new_user :: %__MODULE__{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
@type changeset :: Changeset.t(t() | new_user())
|
@type changeset :: Changeset.t(t() | new_user())
|
||||||
@type role :: :admin | :user
|
@type role :: :user | :admin
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
A user changeset for registration.
|
A user changeset for registration.
|
||||||
@ -73,18 +69,18 @@ defmodule Memex.Accounts.User do
|
|||||||
validations on a LiveView form), this option can be set to `false`.
|
validations on a LiveView form), this option can be set to `false`.
|
||||||
Defaults to `true`.
|
Defaults to `true`.
|
||||||
"""
|
"""
|
||||||
@spec registration_changeset(attrs :: map(), Invite.t() | nil) :: changeset()
|
@spec registration_changeset(attrs :: map()) :: changeset()
|
||||||
@spec registration_changeset(attrs :: map(), Invite.t() | nil, opts :: keyword()) :: changeset()
|
@spec registration_changeset(attrs :: map(), opts :: keyword()) :: changeset()
|
||||||
def registration_changeset(attrs, invite, opts \\ []) do
|
def registration_changeset(attrs, opts \\ []) do
|
||||||
%User{}
|
%__MODULE__{}
|
||||||
|> cast(attrs, [:email, :password, :locale])
|
|> cast(attrs, [:email, :password, :locale])
|
||||||
|> put_change(:invite_id, if(invite, do: invite.id))
|
|
||||||
|> validate_email()
|
|> validate_email()
|
||||||
|> validate_password(opts)
|
|> validate_password(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
A user changeset for role.
|
A user changeset for role.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec role_changeset(t() | new_user() | changeset(), role()) :: changeset()
|
@spec role_changeset(t() | new_user() | changeset(), role()) :: changeset()
|
||||||
def role_changeset(user, role) do
|
def role_changeset(user, role) do
|
||||||
@ -103,8 +99,7 @@ defmodule Memex.Accounts.User do
|
|||||||
|> unique_constraint(:email)
|
|> unique_constraint(:email)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec validate_password(changeset(), opts :: keyword()) ::
|
@spec validate_password(changeset(), opts :: keyword()) :: changeset()
|
||||||
changeset()
|
|
||||||
defp validate_password(changeset, opts) do
|
defp validate_password(changeset, opts) do
|
||||||
changeset
|
changeset
|
||||||
|> validate_required([:password])
|
|> validate_required([:password])
|
||||||
@ -182,12 +177,12 @@ defmodule Memex.Accounts.User do
|
|||||||
`Bcrypt.no_user_verify/0` to avoid timing attacks.
|
`Bcrypt.no_user_verify/0` to avoid timing attacks.
|
||||||
"""
|
"""
|
||||||
@spec valid_password?(t(), String.t()) :: boolean()
|
@spec valid_password?(t(), String.t()) :: boolean()
|
||||||
def valid_password?(%User{hashed_password: hashed_password}, password)
|
def valid_password?(%__MODULE__{hashed_password: hashed_password}, password)
|
||||||
when is_binary(hashed_password) and byte_size(password) > 0 do
|
when is_binary(hashed_password) and byte_size(password) > 0 do
|
||||||
Bcrypt.verify_pass(password, hashed_password)
|
Bcrypt.verify_pass(password, hashed_password)
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_password?(_invalid_user, _invalid_password) do
|
def valid_password?(_, _) do
|
||||||
Bcrypt.no_user_verify()
|
Bcrypt.no_user_verify()
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
@ -5,8 +5,6 @@ defmodule Memex.Accounts.UserToken do
|
|||||||
|
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
alias Ecto.{Association, UUID}
|
|
||||||
alias Memex.Accounts.User
|
|
||||||
|
|
||||||
@hash_algorithm :sha256
|
@hash_algorithm :sha256
|
||||||
@rand_size 32
|
@rand_size 32
|
||||||
@ -24,25 +22,11 @@ defmodule Memex.Accounts.UserToken do
|
|||||||
field :token, :binary
|
field :token, :binary
|
||||||
field :context, :string
|
field :context, :string
|
||||||
field :sent_to, :string
|
field :sent_to, :string
|
||||||
|
belongs_to :user, Memex.Accounts.User
|
||||||
belongs_to :user, User
|
|
||||||
|
|
||||||
timestamps(updated_at: false)
|
timestamps(updated_at: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
|
||||||
id: id(),
|
|
||||||
token: token(),
|
|
||||||
context: String.t(),
|
|
||||||
sent_to: String.t(),
|
|
||||||
user: User.t() | Association.NotLoaded.t(),
|
|
||||||
user_id: User.id() | nil,
|
|
||||||
inserted_at: NaiveDateTime.t()
|
|
||||||
}
|
|
||||||
@type new_user_token :: %__MODULE__{}
|
|
||||||
@type id :: UUID.t()
|
|
||||||
@type token :: binary()
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Generates a token that will be stored in a signed place,
|
Generates a token that will be stored in a signed place,
|
||||||
such as session or cookie. As they are signed, those
|
such as session or cookie. As they are signed, those
|
||||||
@ -50,7 +34,7 @@ defmodule Memex.Accounts.UserToken do
|
|||||||
"""
|
"""
|
||||||
def build_session_token(user) do
|
def build_session_token(user) do
|
||||||
token = :crypto.strong_rand_bytes(@rand_size)
|
token = :crypto.strong_rand_bytes(@rand_size)
|
||||||
{token, %__MODULE__{token: token, context: "session", user_id: user.id}}
|
{token, %Memex.Accounts.UserToken{token: token, context: "session", user_id: user.id}}
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -85,7 +69,7 @@ defmodule Memex.Accounts.UserToken do
|
|||||||
hashed_token = :crypto.hash(@hash_algorithm, token)
|
hashed_token = :crypto.hash(@hash_algorithm, token)
|
||||||
|
|
||||||
{Base.url_encode64(token, padding: false),
|
{Base.url_encode64(token, padding: false),
|
||||||
%__MODULE__{
|
%Memex.Accounts.UserToken{
|
||||||
token: hashed_token,
|
token: hashed_token,
|
||||||
context: context,
|
context: context,
|
||||||
sent_to: sent_to,
|
sent_to: sent_to,
|
||||||
@ -145,17 +129,17 @@ defmodule Memex.Accounts.UserToken do
|
|||||||
Returns the given token with the given context.
|
Returns the given token with the given context.
|
||||||
"""
|
"""
|
||||||
def token_and_context_query(token, context) do
|
def token_and_context_query(token, context) do
|
||||||
from __MODULE__, where: [token: ^token, context: ^context]
|
from Memex.Accounts.UserToken, where: [token: ^token, context: ^context]
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets all tokens for the given user for the given contexts.
|
Gets all tokens for the given user for the given contexts.
|
||||||
"""
|
"""
|
||||||
def user_and_contexts_query(user, :all) do
|
def user_and_contexts_query(user, :all) do
|
||||||
from t in __MODULE__, where: t.user_id == ^user.id
|
from t in Memex.Accounts.UserToken, where: t.user_id == ^user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_and_contexts_query(user, [_ | _] = contexts) do
|
def user_and_contexts_query(user, [_ | _] = contexts) do
|
||||||
from t in __MODULE__, where: t.user_id == ^user.id and t.context in ^contexts
|
from t in Memex.Accounts.UserToken, where: t.user_id == ^user.id and t.context in ^contexts
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,6 @@ defmodule Memex.Application do
|
|||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
|
||||||
use Application
|
use Application
|
||||||
alias Memex.ErrorReporter
|
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
@ -18,24 +17,16 @@ defmodule Memex.Application do
|
|||||||
# Start the Endpoint (http/https)
|
# Start the Endpoint (http/https)
|
||||||
MemexWeb.Endpoint,
|
MemexWeb.Endpoint,
|
||||||
# Add Oban
|
# Add Oban
|
||||||
{Oban, oban_config()},
|
{Oban, oban_config()}
|
||||||
Memex.Repo.Migrator
|
|
||||||
# Start a worker by calling: Memex.Worker.start_link(arg)
|
# Start a worker by calling: Memex.Worker.start_link(arg)
|
||||||
# {Memex.Worker, arg}
|
# {Memex.Worker, arg}
|
||||||
]
|
]
|
||||||
|
|
||||||
# Oban events logging https://hexdocs.pm/oban/Oban.html#module-reporting-errors
|
# Automatically migrate on start in prod
|
||||||
:ok =
|
children =
|
||||||
:telemetry.attach_many(
|
if Application.get_env(:memex, Memex.Application, automigrate: false)[:automigrate],
|
||||||
"oban-logger",
|
do: children ++ [Memex.Repo.Migrator],
|
||||||
[
|
else: children
|
||||||
[:oban, :job, :exception],
|
|
||||||
[:oban, :job, :start],
|
|
||||||
[:oban, :job, :stop]
|
|
||||||
],
|
|
||||||
&ErrorReporter.handle_event/4,
|
|
||||||
[]
|
|
||||||
)
|
|
||||||
|
|
||||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||||
# for other strategies and supported options
|
# for other strategies and supported options
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
defmodule Memex.ErrorReporter do
|
|
||||||
@moduledoc """
|
|
||||||
Custom logger for telemetry events
|
|
||||||
|
|
||||||
Oban implementation taken from
|
|
||||||
https://hexdocs.pm/oban/Oban.html#module-reporting-errors
|
|
||||||
"""
|
|
||||||
|
|
||||||
require Logger
|
|
||||||
|
|
||||||
def handle_event([:oban, :job, :exception], measure, %{stacktrace: stacktrace} = meta, _config) do
|
|
||||||
data =
|
|
||||||
get_oban_job_data(meta, measure)
|
|
||||||
|> Map.put(:stacktrace, Exception.format_stacktrace(stacktrace))
|
|
||||||
|
|
||||||
Logger.error(meta.reason, data: pretty_encode(data))
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_event([:oban, :job, :start], measure, meta, _config) do
|
|
||||||
Logger.info("Started oban job", data: get_oban_job_data(meta, measure) |> pretty_encode())
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_event([:oban, :job, :stop], measure, meta, _config) do
|
|
||||||
Logger.info("Finished oban job", data: get_oban_job_data(meta, measure) |> pretty_encode())
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_event([:oban, :job, unhandled_event], measure, meta, _config) do
|
|
||||||
data =
|
|
||||||
get_oban_job_data(meta, measure)
|
|
||||||
|> Map.put(:event, unhandled_event)
|
|
||||||
|
|
||||||
Logger.warning("Unhandled oban job event", data: pretty_encode(data))
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_event(unhandled_event, measure, meta, config) do
|
|
||||||
data = %{
|
|
||||||
event: unhandled_event,
|
|
||||||
meta: meta,
|
|
||||||
measurements: measure,
|
|
||||||
config: config
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.warning("Unhandled telemetry event", data: pretty_encode(data))
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_oban_job_data(%{job: job}, measure) do
|
|
||||||
job
|
|
||||||
|> Map.take([:id, :args, :meta, :queue, :worker])
|
|
||||||
|> Map.merge(measure)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp pretty_encode(data) do
|
|
||||||
data
|
|
||||||
|> Jason.encode!()
|
|
||||||
|> Jason.Formatter.pretty_print()
|
|
||||||
end
|
|
||||||
end
|
|
173
lib/memex/invites.ex
Normal file
173
lib/memex/invites.ex
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
defmodule Memex.Invites do
|
||||||
|
@moduledoc """
|
||||||
|
The Invites context.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import Ecto.Query, warn: false
|
||||||
|
alias Ecto.Changeset
|
||||||
|
alias Memex.{Accounts.User, Invites.Invite, Repo}
|
||||||
|
|
||||||
|
@invite_token_length 20
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns the list of invites.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> list_invites(%User{id: 123, role: :admin})
|
||||||
|
[%Invite{}, ...]
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec list_invites(User.t()) :: [Invite.t()]
|
||||||
|
def list_invites(%User{role: :admin}) do
|
||||||
|
Repo.all(from i in Invite, order_by: i.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Gets a single invite.
|
||||||
|
|
||||||
|
Raises `Ecto.NoResultsError` if the Invite does not exist.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> get_invite!(123, %User{id: 123, role: :admin})
|
||||||
|
%Invite{}
|
||||||
|
|
||||||
|
iex> get_invite!(456, %User{id: 123, role: :admin})
|
||||||
|
** (Ecto.NoResultsError)
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec get_invite!(Invite.id(), User.t()) :: Invite.t()
|
||||||
|
def get_invite!(id, %User{role: :admin}) do
|
||||||
|
Repo.get!(Invite, id)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns a valid invite or nil based on the attempted token
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> get_invite_by_token("valid_token")
|
||||||
|
%Invite{}
|
||||||
|
|
||||||
|
iex> get_invite_by_token("invalid_token")
|
||||||
|
nil
|
||||||
|
"""
|
||||||
|
@spec get_invite_by_token(token :: String.t() | nil) :: Invite.t() | nil
|
||||||
|
def get_invite_by_token(nil), do: nil
|
||||||
|
def get_invite_by_token(""), do: nil
|
||||||
|
|
||||||
|
def get_invite_by_token(token) do
|
||||||
|
Repo.one(
|
||||||
|
from(i in Invite,
|
||||||
|
where: i.token == ^token and i.disabled_at |> is_nil()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Uses invite by decrementing uses_left, or marks invite invalid if it's been
|
||||||
|
completely used.
|
||||||
|
"""
|
||||||
|
@spec use_invite!(Invite.t()) :: Invite.t()
|
||||||
|
def use_invite!(%Invite{uses_left: nil} = invite), do: invite
|
||||||
|
|
||||||
|
def use_invite!(%Invite{uses_left: uses_left} = invite) do
|
||||||
|
new_uses_left = uses_left - 1
|
||||||
|
|
||||||
|
attrs =
|
||||||
|
if new_uses_left <= 0 do
|
||||||
|
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
||||||
|
%{"uses_left" => 0, "disabled_at" => now}
|
||||||
|
else
|
||||||
|
%{"uses_left" => new_uses_left}
|
||||||
|
end
|
||||||
|
|
||||||
|
invite |> Invite.update_changeset(attrs) |> Repo.update!()
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Creates a invite.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> create_invite(%User{id: 123, role: :admin}, %{field: value})
|
||||||
|
{:ok, %Invite{}}
|
||||||
|
|
||||||
|
iex> create_invite(%User{id: 123, role: :admin}, %{field: bad_value})
|
||||||
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec create_invite(User.t(), attrs :: map()) ::
|
||||||
|
{:ok, Invite.t()} | {:error, Changeset.t(Invite.new_invite())}
|
||||||
|
def create_invite(%User{id: user_id, role: :admin}, attrs) do
|
||||||
|
token =
|
||||||
|
:crypto.strong_rand_bytes(@invite_token_length)
|
||||||
|
|> Base.url_encode64()
|
||||||
|
|> binary_part(0, @invite_token_length)
|
||||||
|
|
||||||
|
attrs = attrs |> Map.merge(%{"user_id" => user_id, "token" => token})
|
||||||
|
|
||||||
|
%Invite{} |> Invite.create_changeset(attrs) |> Repo.insert()
|
||||||
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Updates a invite.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> update_invite(invite, %{field: new_value}, %User{id: 123, role: :admin})
|
||||||
|
{:ok, %Invite{}}
|
||||||
|
|
||||||
|
iex> update_invite(invite, %{field: bad_value}, %User{id: 123, role: :admin})
|
||||||
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec update_invite(Invite.t(), attrs :: map(), User.t()) ::
|
||||||
|
{:ok, Invite.t()} | {:error, Changeset.t(Invite.t())}
|
||||||
|
def update_invite(invite, attrs, %User{role: :admin}),
|
||||||
|
do: invite |> Invite.update_changeset(attrs) |> Repo.update()
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Deletes a invite.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> delete_invite(invite, %User{id: 123, role: :admin})
|
||||||
|
{:ok, %Invite{}}
|
||||||
|
|
||||||
|
iex> delete_invite(invite, %User{id: 123, role: :admin})
|
||||||
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec delete_invite(Invite.t(), User.t()) ::
|
||||||
|
{:ok, Invite.t()} | {:error, Changeset.t(Invite.t())}
|
||||||
|
def delete_invite(invite, %User{role: :admin}), do: invite |> Repo.delete()
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Deletes a invite.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> delete_invite(invite, %User{id: 123, role: :admin})
|
||||||
|
%Invite{}
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec delete_invite!(Invite.t(), User.t()) :: Invite.t()
|
||||||
|
def delete_invite!(invite, %User{role: :admin}), do: invite |> Repo.delete!()
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns an `%Changeset{}` for tracking invite changes.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> change_invite(invite)
|
||||||
|
%Changeset{data: %Invite{}}
|
||||||
|
|
||||||
|
"""
|
||||||
|
@spec change_invite(Invite.t() | Invite.new_invite()) ::
|
||||||
|
Changeset.t(Invite.t() | Invite.new_invite())
|
||||||
|
@spec change_invite(Invite.t() | Invite.new_invite(), attrs :: map()) ::
|
||||||
|
Changeset.t(Invite.t() | Invite.new_invite())
|
||||||
|
def change_invite(invite, attrs \\ %{}), do: invite |> Invite.update_changeset(attrs)
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
defmodule Memex.Accounts.Invite do
|
defmodule Memex.Invites.Invite do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
An invite, created by an admin to allow someone to join their instance. An
|
An invite, created by an admin to allow someone to join their instance. An
|
||||||
invite can be enabled or disabled, and can have an optional number of uses if
|
invite can be enabled or disabled, and can have an optional number of uses if
|
||||||
@ -7,8 +7,8 @@ defmodule Memex.Accounts.Invite do
|
|||||||
|
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Ecto.{Association, Changeset, UUID}
|
alias Ecto.{Changeset, UUID}
|
||||||
alias Memex.Accounts.User
|
alias Memex.{Accounts.User, Invites.Invite}
|
||||||
|
|
||||||
@primary_key {:id, :binary_id, autogenerate: true}
|
@primary_key {:id, :binary_id, autogenerate: true}
|
||||||
@foreign_key_type :binary_id
|
@foreign_key_type :binary_id
|
||||||
@ -18,46 +18,40 @@ defmodule Memex.Accounts.Invite do
|
|||||||
field :uses_left, :integer, default: nil
|
field :uses_left, :integer, default: nil
|
||||||
field :disabled_at, :naive_datetime
|
field :disabled_at, :naive_datetime
|
||||||
|
|
||||||
belongs_to :created_by, User
|
belongs_to :user, User
|
||||||
|
|
||||||
has_many :users, User
|
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %Invite{
|
||||||
id: id(),
|
id: id(),
|
||||||
name: String.t(),
|
name: String.t(),
|
||||||
token: token(),
|
token: String.t(),
|
||||||
uses_left: integer() | nil,
|
uses_left: integer() | nil,
|
||||||
disabled_at: NaiveDateTime.t(),
|
disabled_at: NaiveDateTime.t(),
|
||||||
created_by: User.t() | nil | Association.NotLoaded.t(),
|
user: User.t(),
|
||||||
created_by_id: User.id() | nil,
|
user_id: User.id(),
|
||||||
users: [User.t()] | Association.NotLoaded.t(),
|
|
||||||
inserted_at: NaiveDateTime.t(),
|
inserted_at: NaiveDateTime.t(),
|
||||||
updated_at: NaiveDateTime.t()
|
updated_at: NaiveDateTime.t()
|
||||||
}
|
}
|
||||||
@type new_invite :: %__MODULE__{}
|
@type new_invite :: %Invite{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
@type changeset :: Changeset.t(t() | new_invite())
|
|
||||||
@type token :: String.t()
|
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(User.t(), token(), attrs :: map()) :: changeset()
|
@spec create_changeset(new_invite(), attrs :: map()) :: Changeset.t(new_invite())
|
||||||
def create_changeset(%User{id: user_id}, token, attrs) do
|
def create_changeset(invite, attrs) do
|
||||||
%__MODULE__{}
|
invite
|
||||||
|> change(token: token, created_by_id: user_id)
|
|> cast(attrs, [:name, :token, :uses_left, :disabled_at, :user_id])
|
||||||
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
|> validate_required([:name, :token, :user_id])
|
||||||
|> validate_required([:name, :token, :created_by_id])
|
|
||||||
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_invite(), attrs :: map()) :: changeset()
|
@spec update_changeset(t() | new_invite(), attrs :: map()) :: Changeset.t(t() | new_invite())
|
||||||
def update_changeset(invite, attrs) do
|
def update_changeset(invite, attrs) do
|
||||||
invite
|
invite
|
||||||
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
||||||
|> validate_required([:name])
|
|> validate_required([:name, :token, :user_id])
|
||||||
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -7,9 +7,7 @@ defmodule Memex.Release do
|
|||||||
|
|
||||||
def rollback(repo, version) do
|
def rollback(repo, version) do
|
||||||
load_app()
|
load_app()
|
||||||
|
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
|
||||||
{:ok, _fun_return, _apps} =
|
|
||||||
Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp load_app do
|
defp load_app do
|
||||||
@ -20,8 +18,7 @@ defmodule Memex.Release do
|
|||||||
load_app()
|
load_app()
|
||||||
|
|
||||||
for repo <- Application.fetch_env!(@app, :ecto_repos) do
|
for repo <- Application.fetch_env!(@app, :ecto_repos) do
|
||||||
{:ok, _fun_return, _apps} =
|
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
|
||||||
Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,20 +6,17 @@ defmodule Memex.Repo.Migrator do
|
|||||||
use GenServer
|
use GenServer
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
def start_link(_opts) do
|
def start_link(_) do
|
||||||
GenServer.start_link(__MODULE__, [], [])
|
GenServer.start_link(__MODULE__, [], [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def init(_opts) do
|
def init(_) do
|
||||||
{:ok, if(automigrate_enabled?(), do: migrate!())}
|
migrate!()
|
||||||
|
{:ok, nil}
|
||||||
end
|
end
|
||||||
|
|
||||||
def migrate! do
|
def migrate! do
|
||||||
path = Application.app_dir(:lokal, "priv/repo/migrations")
|
path = Application.app_dir(:memex, "priv/repo/migrations")
|
||||||
Ecto.Migrator.run(Lokal.Repo, path, :up, all: true)
|
Ecto.Migrator.run(Memex.Repo, path, :up, all: true)
|
||||||
end
|
|
||||||
|
|
||||||
defp automigrate_enabled? do
|
|
||||||
Application.get_env(:lokal, Lokal.Application, automigrate: false)[:automigrate]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -73,16 +73,15 @@ defmodule MemexWeb do
|
|||||||
quote do
|
quote do
|
||||||
use Phoenix.Router
|
use Phoenix.Router
|
||||||
|
|
||||||
import Phoenix.{Controller, LiveView.Router}
|
|
||||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
|
import Phoenix.Controller
|
||||||
|
import Phoenix.LiveView.Router
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def channel do
|
def channel do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Channel
|
use Phoenix.Channel
|
||||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
|
||||||
import MemexWeb.Gettext
|
import MemexWeb.Gettext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -90,15 +89,16 @@ defmodule MemexWeb do
|
|||||||
defp view_helpers do
|
defp view_helpers do
|
||||||
quote do
|
quote do
|
||||||
# Use all HTML functionality (forms, tags, etc)
|
# Use all HTML functionality (forms, tags, etc)
|
||||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
|
||||||
use Phoenix.HTML
|
use Phoenix.HTML
|
||||||
|
|
||||||
# Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc)
|
# Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc)
|
||||||
# Import basic rendering functionality (render, render_layout, etc)
|
import Phoenix.Component
|
||||||
import Phoenix.{Component, View}
|
import MemexWeb.LiveHelpers
|
||||||
import MemexWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers}
|
|
||||||
|
|
||||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
# Import basic rendering functionality (render, render_layout, etc)
|
||||||
|
import Phoenix.View
|
||||||
|
|
||||||
|
import MemexWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers}
|
||||||
alias MemexWeb.Endpoint
|
alias MemexWeb.Endpoint
|
||||||
alias MemexWeb.Router.Helpers, as: Routes
|
alias MemexWeb.Router.Helpers, as: Routes
|
||||||
end
|
end
|
||||||
|
@ -109,13 +109,11 @@ defmodule MemexWeb.Components.ContextsTableComponent do
|
|||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex flex-wrap justify-center space-x-1">
|
<div class="flex flex-wrap justify-center space-x-1">
|
||||||
<.link
|
<%= for tag <- @tags do %>
|
||||||
:for={tag <- @tags}
|
<.link patch={Routes.context_index_path(Endpoint, :search, tag)} class="link">
|
||||||
patch={Routes.context_index_path(Endpoint, :search, tag)}
|
|
||||||
class="link"
|
|
||||||
>
|
|
||||||
<%= tag %>
|
<%= tag %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
@ -4,19 +4,9 @@ defmodule MemexWeb.Components.InviteCard do
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
use MemexWeb, :component
|
use MemexWeb, :component
|
||||||
alias Memex.Accounts.{Invite, Invites, User}
|
|
||||||
alias MemexWeb.Endpoint
|
|
||||||
|
|
||||||
attr :invite, Invite, required: true
|
def invite_card(assigns) do
|
||||||
attr :current_user, User, required: true
|
assigns = assigns |> assign_new(:code_actions, fn -> [] end)
|
||||||
slot(:inner_block)
|
|
||||||
slot(:code_actions)
|
|
||||||
|
|
||||||
def invite_card(%{invite: invite, current_user: current_user} = assigns) do
|
|
||||||
assigns =
|
|
||||||
assigns
|
|
||||||
|> assign(:use_count, Invites.get_use_count(invite, current_user))
|
|
||||||
|> assign_new(:code_actions, fn -> [] end)
|
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4
|
<div class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4
|
||||||
@ -30,8 +20,8 @@ defmodule MemexWeb.Components.InviteCard do
|
|||||||
<h2 class="title text-md">
|
<h2 class="title text-md">
|
||||||
<%= if @invite.uses_left do %>
|
<%= if @invite.uses_left do %>
|
||||||
<%= gettext(
|
<%= gettext(
|
||||||
"uses left: %{uses_left_count}",
|
"uses left: %{uses_left}",
|
||||||
uses_left_count: @invite.uses_left
|
uses_left: @invite.uses_left
|
||||||
) %>
|
) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= gettext("uses left: unlimited") %>
|
<%= gettext("uses left: unlimited") %>
|
||||||
@ -48,10 +38,6 @@ defmodule MemexWeb.Components.InviteCard do
|
|||||||
filename={@invite.name}
|
filename={@invite.name}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h2 :if={@use_count != 0} class="title text-md">
|
|
||||||
<%= gettext("uses: %{uses_count}", uses_count: @use_count) %>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div class="flex flex-row flex-wrap justify-center items-center">
|
<div class="flex flex-row flex-wrap justify-center items-center">
|
||||||
<code
|
<code
|
||||||
id={"code-#{@invite.id}"}
|
id={"code-#{@invite.id}"}
|
||||||
@ -61,9 +47,11 @@ defmodule MemexWeb.Components.InviteCard do
|
|||||||
<%= render_slot(@code_actions) %>
|
<%= render_slot(@code_actions) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :if={@inner_block} class="flex space-x-4 justify-center items-center">
|
<%= if @inner_block do %>
|
||||||
|
<div class="flex space-x-4 justify-center items-center">
|
||||||
<%= render_slot(@inner_block) %>
|
<%= render_slot(@inner_block) %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
@ -109,9 +109,11 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
|||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex flex-wrap justify-center space-x-1">
|
<div class="flex flex-wrap justify-center space-x-1">
|
||||||
<.link :for={tag <- @tags} patch={Routes.note_index_path(Endpoint, :search, tag)} class="link">
|
<%= for tag <- @tags do %>
|
||||||
|
<.link patch={Routes.note_index_path(Endpoint, :search, tag)} class="link">
|
||||||
<%= tag %>
|
<%= tag %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
@ -122,13 +122,11 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
|||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex flex-wrap justify-center space-x-1">
|
<div class="flex flex-wrap justify-center space-x-1">
|
||||||
<.link
|
<%= for tag <- @tags do %>
|
||||||
:for={tag <- @tags}
|
<.link patch={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link">
|
||||||
patch={Routes.pipeline_index_path(Endpoint, :search, tag)}
|
|
||||||
class="link"
|
|
||||||
>
|
|
||||||
<%= tag %>
|
<%= tag %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
@ -33,11 +33,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<%= for {values, i} <- @rows |> Enum.with_index() do %>
|
||||||
:for={{values, i} <- @rows |> Enum.with_index()}
|
<tr class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}>
|
||||||
class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}
|
<%= for %{key: key} = value <- @columns do %>
|
||||||
>
|
<td class={["p-2", value[:class]]}>
|
||||||
<td :for={%{key: key} = value <- @columns} class={["p-2", value[:class]]}>
|
|
||||||
<%= case values |> Map.get(key) do %>
|
<%= case values |> Map.get(key) do %>
|
||||||
<% {_custom_sort_value, value} -> %>
|
<% {_custom_sort_value, value} -> %>
|
||||||
<%= value %>
|
<%= value %>
|
||||||
@ -45,7 +44,9 @@
|
|||||||
<%= value %>
|
<%= value %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,7 +65,8 @@ defmodule MemexWeb.Components.Topbar do
|
|||||||
<li class="mx-2 my-1 border-left border border-primary-700"></li>
|
<li class="mx-2 my-1 border-left border border-primary-700"></li>
|
||||||
|
|
||||||
<%= if @current_user do %>
|
<%= if @current_user do %>
|
||||||
<li :if={@current_user |> Accounts.is_already_admin?()} class="mx-2 my-1">
|
<%= if @current_user |> Accounts.is_already_admin?() do %>
|
||||||
|
<li class="mx-2 my-1">
|
||||||
<.link
|
<.link
|
||||||
navigate={Routes.invite_index_path(Endpoint, :index)}
|
navigate={Routes.invite_index_path(Endpoint, :index)}
|
||||||
class="text-primary-400 text-primary-400 hover:underline"
|
class="text-primary-400 text-primary-400 hover:underline"
|
||||||
@ -73,6 +74,7 @@ defmodule MemexWeb.Components.Topbar do
|
|||||||
<%= gettext("invites") %>
|
<%= gettext("invites") %>
|
||||||
</.link>
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<.link
|
<.link
|
||||||
@ -93,12 +95,8 @@ defmodule MemexWeb.Components.Topbar do
|
|||||||
</.link>
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li
|
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||||
:if={
|
<li class="mx-2 my-1">
|
||||||
@current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2)
|
|
||||||
}
|
|
||||||
class="mx-2 my-1"
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
navigate={Routes.live_dashboard_path(Endpoint, :home)}
|
navigate={Routes.live_dashboard_path(Endpoint, :home)}
|
||||||
class="text-primary-400 text-primary-400 hover:underline"
|
class="text-primary-400 text-primary-400 hover:underline"
|
||||||
@ -106,8 +104,10 @@ defmodule MemexWeb.Components.Topbar do
|
|||||||
<i class="fas fa-gauge"></i>
|
<i class="fas fa-gauge"></i>
|
||||||
</.link>
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li :if={Accounts.allow_registration?()} class="mx-2 my-1">
|
<%= if Accounts.allow_registration?() do %>
|
||||||
|
<li class="mx-2 my-1">
|
||||||
<.link
|
<.link
|
||||||
navigate={Routes.user_registration_path(Endpoint, :new)}
|
navigate={Routes.user_registration_path(Endpoint, :new)}
|
||||||
class="text-primary-400 text-primary-400 hover:underline truncate"
|
class="text-primary-400 text-primary-400 hover:underline truncate"
|
||||||
@ -115,6 +115,7 @@ defmodule MemexWeb.Components.Topbar do
|
|||||||
<%= dgettext("actions", "register") %>
|
<%= dgettext("actions", "register") %>
|
||||||
</.link>
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<li class="mx-2 my-1">
|
<li class="mx-2 my-1">
|
||||||
<.link
|
<.link
|
||||||
|
@ -39,9 +39,11 @@ defmodule MemexWeb.Components.UserCard do
|
|||||||
</p>
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div :if={@inner_block} class="px-4 py-2 flex space-x-4 justify-center items-center">
|
<%= if @inner_block do %>
|
||||||
|
<div class="px-4 py-2 flex space-x-4 justify-center items-center">
|
||||||
<%= render_slot(@inner_block) %>
|
<%= render_slot(@inner_block) %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
defmodule MemexWeb.UserRegistrationController do
|
defmodule MemexWeb.UserRegistrationController do
|
||||||
use MemexWeb, :controller
|
use MemexWeb, :controller
|
||||||
import MemexWeb.Gettext
|
import MemexWeb.Gettext
|
||||||
alias Memex.{Accounts, Accounts.Invites}
|
alias Memex.{Accounts, Invites}
|
||||||
alias MemexWeb.{Endpoint, HomeLive}
|
alias MemexWeb.HomeLive
|
||||||
|
|
||||||
def new(conn, %{"invite" => invite_token}) do
|
def new(conn, %{"invite" => invite_token}) do
|
||||||
if Invites.valid_invite_token?(invite_token) do
|
invite = Invites.get_invite_by_token(invite_token)
|
||||||
conn |> render_new(invite_token)
|
|
||||||
|
if invite do
|
||||||
|
conn |> render_new(invite)
|
||||||
else
|
else
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
|
|> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
|
||||||
@ -25,17 +27,19 @@ defmodule MemexWeb.UserRegistrationController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# renders new user registration page
|
# renders new user registration page
|
||||||
defp render_new(conn, invite_token \\ nil) do
|
defp render_new(conn, invite \\ nil) do
|
||||||
render(conn, "new.html",
|
render(conn, "new.html",
|
||||||
changeset: Accounts.change_user_registration(),
|
changeset: Accounts.change_user_registration(),
|
||||||
invite_token: invite_token,
|
invite: invite,
|
||||||
page_title: gettext("register")
|
page_title: gettext("register")
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(conn, %{"user" => %{"invite_token" => invite_token}} = attrs) do
|
def create(conn, %{"user" => %{"invite_token" => invite_token}} = attrs) do
|
||||||
if Invites.valid_invite_token?(invite_token) do
|
invite = Invites.get_invite_by_token(invite_token)
|
||||||
conn |> create_user(attrs, invite_token)
|
|
||||||
|
if invite do
|
||||||
|
conn |> create_user(attrs, invite)
|
||||||
else
|
else
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
|
|> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
|
||||||
@ -53,25 +57,24 @@ defmodule MemexWeb.UserRegistrationController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp create_user(conn, %{"user" => user_params}, invite_token \\ nil) do
|
defp create_user(conn, %{"user" => user_params}, invite \\ nil) do
|
||||||
case Accounts.register_user(user_params, invite_token) do
|
case Accounts.register_user(user_params) do
|
||||||
{:ok, user} ->
|
{:ok, user} ->
|
||||||
|
unless invite |> is_nil() do
|
||||||
|
invite |> Invites.use_invite!()
|
||||||
|
end
|
||||||
|
|
||||||
Accounts.deliver_user_confirmation_instructions(
|
Accounts.deliver_user_confirmation_instructions(
|
||||||
user,
|
user,
|
||||||
&Routes.user_confirmation_url(conn, :confirm, &1)
|
&Routes.user_confirmation_url(conn, :confirm, &1)
|
||||||
)
|
)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, dgettext("prompts", "please check your email to verify your account"))
|
|> put_flash(:info, dgettext("prompts", "Please check your email to verify your account"))
|
||||||
|> redirect(to: Routes.user_session_path(Endpoint, :new))
|
|> redirect(to: Routes.user_session_path(Endpoint, :new))
|
||||||
|
|
||||||
{:error, :invalid_token} ->
|
|
||||||
conn
|
|
||||||
|> put_flash(:error, dgettext("errors", "sorry, this invite was not found or expired"))
|
|
||||||
|> redirect(to: Routes.live_path(Endpoint, HomeLive))
|
|
||||||
|
|
||||||
{:error, %Ecto.Changeset{} = changeset} ->
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
conn |> render("new.html", changeset: changeset, invite_token: invite_token)
|
conn |> render("new.html", changeset: changeset, invite: invite)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@ defmodule MemexWeb.UserSettingsController do
|
|||||||
plug :assign_email_and_password_changesets
|
plug :assign_email_and_password_changesets
|
||||||
|
|
||||||
def edit(conn, _params) do
|
def edit(conn, _params) do
|
||||||
render(conn, "edit.html", page_title: gettext("settings"))
|
render(conn, "edit.html", page_title: gettext("Settings"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(%{assigns: %{current_user: user}} = conn, %{
|
def update(%{assigns: %{current_user: user}} = conn, %{
|
||||||
@ -28,7 +28,7 @@ defmodule MemexWeb.UserSettingsController do
|
|||||||
:info,
|
:info,
|
||||||
dgettext(
|
dgettext(
|
||||||
"prompts",
|
"prompts",
|
||||||
"a link to confirm your email change has been sent to the new address."
|
"A link to confirm your email change has been sent to the new address."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
||||||
@ -46,7 +46,7 @@ defmodule MemexWeb.UserSettingsController do
|
|||||||
case Accounts.update_user_password(user, password, user_params) do
|
case Accounts.update_user_password(user, password, user_params) do
|
||||||
{:ok, user} ->
|
{:ok, user} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, dgettext("prompts", "password updated successfully."))
|
|> put_flash(:info, dgettext("prompts", "Password updated successfully."))
|
||||||
|> put_session(:user_return_to, Routes.user_settings_path(conn, :edit))
|
|> put_session(:user_return_to, Routes.user_settings_path(conn, :edit))
|
||||||
|> UserAuth.log_in_user(user)
|
|> UserAuth.log_in_user(user)
|
||||||
|
|
||||||
@ -74,14 +74,14 @@ defmodule MemexWeb.UserSettingsController do
|
|||||||
case Accounts.update_user_email(user, token) do
|
case Accounts.update_user_email(user, token) do
|
||||||
:ok ->
|
:ok ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, dgettext("prompts", "email changed successfully."))
|
|> put_flash(:info, dgettext("prompts", "Email changed successfully."))
|
||||||
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
||||||
|
|
||||||
:error ->
|
:error ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(
|
|> put_flash(
|
||||||
:error,
|
:error,
|
||||||
dgettext("errors", "email change link is invalid or it has expired.")
|
dgettext("errors", "Email change link is invalid or it has expired.")
|
||||||
)
|
)
|
||||||
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
||||||
end
|
end
|
||||||
@ -92,11 +92,11 @@ defmodule MemexWeb.UserSettingsController do
|
|||||||
current_user |> Accounts.delete_user!(current_user)
|
current_user |> Accounts.delete_user!(current_user)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, dgettext("prompts", "your account has been deleted"))
|
|> put_flash(:error, dgettext("prompts", "Your account has been deleted"))
|
||||||
|> redirect(to: Routes.live_path(conn, HomeLive))
|
|> redirect(to: Routes.live_path(conn, HomeLive))
|
||||||
else
|
else
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, dgettext("errors", "unable to delete user"))
|
|> put_flash(:error, dgettext("errors", "Unable to delete user"))
|
||||||
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
|> redirect(to: Routes.user_settings_path(conn, :edit))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -30,15 +30,16 @@
|
|||||||
contexts={@contexts}
|
contexts={@contexts}
|
||||||
>
|
>
|
||||||
<:actions :let={context}>
|
<:actions :let={context}>
|
||||||
|
<%= if is_owner?(context, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner?(context, @current_user)}
|
|
||||||
patch={Routes.context_index_path(@socket, :edit, context.slug)}
|
patch={Routes.context_index_path(@socket, :edit, context.slug)}
|
||||||
data-qa={"context-edit-#{context.id}"}
|
data-qa={"context-edit-#{context.id}"}
|
||||||
>
|
>
|
||||||
<%= dgettext("actions", "edit") %>
|
<%= dgettext("actions", "edit") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<%= if is_owner_or_admin?(context, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner_or_admin?(context, @current_user)}
|
|
||||||
href="#"
|
href="#"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
phx-value-id={context.id}
|
phx-value-id={context.id}
|
||||||
@ -47,20 +48,20 @@
|
|||||||
>
|
>
|
||||||
<%= dgettext("actions", "delete") %>
|
<%= dgettext("actions", "delete") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</:actions>
|
</:actions>
|
||||||
</.live_component>
|
</.live_component>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<.link
|
<%= if @current_user do %>
|
||||||
:if={@current_user}
|
<.link patch={Routes.context_index_path(@socket, :new)} class="self-end btn btn-primary">
|
||||||
patch={Routes.context_index_path(@socket, :new)}
|
|
||||||
class="self-end btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "new context") %>
|
<%= dgettext("actions", "new context") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.context_index_path(@socket, :index)}>
|
<%= if @live_action in [:new, :edit] do %>
|
||||||
|
<.modal return_to={Routes.context_index_path(@socket, :index)}>
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.ContextLive.FormComponent}
|
module={MemexWeb.ContextLive.FormComponent}
|
||||||
id={@context.id || :new}
|
id={@context.id || :new}
|
||||||
@ -70,4 +71,5 @@
|
|||||||
context={@context}
|
context={@context}
|
||||||
return_to={Routes.context_index_path(@socket, :index)}
|
return_to={Routes.context_index_path(@socket, :index)}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
@ -11,7 +11,7 @@ defmodule MemexWeb.ContextLive.Show do
|
|||||||
@impl true
|
@impl true
|
||||||
def handle_params(
|
def handle_params(
|
||||||
%{"slug" => slug},
|
%{"slug" => slug},
|
||||||
_params,
|
_,
|
||||||
%{assigns: %{live_action: live_action, current_user: current_user}} = socket
|
%{assigns: %{live_action: live_action, current_user: current_user}} = socket
|
||||||
) do
|
) do
|
||||||
context =
|
context =
|
||||||
|
@ -4,13 +4,11 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="flex flex-wrap space-x-1">
|
<div class="flex flex-wrap space-x-1">
|
||||||
<.link
|
<%= for tag <- @context.tags do %>
|
||||||
:for={tag <- @context.tags}
|
<.link navigate={Routes.context_index_path(Endpoint, :search, tag)} class="link">
|
||||||
navigate={Routes.context_index_path(Endpoint, :search, tag)}
|
|
||||||
class="link"
|
|
||||||
>
|
|
||||||
<%= tag %>
|
<%= tag %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.context_content context={@context} />
|
<.context_content context={@context} />
|
||||||
@ -23,15 +21,16 @@
|
|||||||
<.link class="btn btn-primary" navigate={Routes.context_index_path(@socket, :index)}>
|
<.link class="btn btn-primary" navigate={Routes.context_index_path(@socket, :index)}>
|
||||||
<%= dgettext("actions", "back") %>
|
<%= dgettext("actions", "back") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<%= if is_owner?(@context, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner?(@context, @current_user)}
|
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
patch={Routes.context_show_path(@socket, :edit, @context.slug)}
|
patch={Routes.context_show_path(@socket, :edit, @context.slug)}
|
||||||
>
|
>
|
||||||
<%= dgettext("actions", "edit") %>
|
<%= dgettext("actions", "edit") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<%= if is_owner_or_admin?(@context, @current_user) do %>
|
||||||
<button
|
<button
|
||||||
:if={is_owner_or_admin?(@context, @current_user)}
|
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
@ -40,13 +39,12 @@
|
|||||||
>
|
>
|
||||||
<%= dgettext("actions", "delete") %>
|
<%= dgettext("actions", "delete") %>
|
||||||
</button>
|
</button>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal
|
<%= if @live_action in [:edit] do %>
|
||||||
:if={@live_action == :edit}
|
<.modal return_to={Routes.context_show_path(@socket, :show, @context.slug)}>
|
||||||
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
|
||||||
>
|
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.ContextLive.FormComponent}
|
module={MemexWeb.ContextLive.FormComponent}
|
||||||
id={@context.id}
|
id={@context.id}
|
||||||
@ -56,4 +54,5 @@
|
|||||||
context={@context}
|
context={@context}
|
||||||
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
@ -3,12 +3,12 @@ defmodule MemexWeb.HomeLive do
|
|||||||
Liveview for the main home page
|
Liveview for the main home page
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@version Mix.Project.config()[:version]
|
||||||
|
|
||||||
use MemexWeb, :live_view
|
use MemexWeb, :live_view
|
||||||
alias Memex.Accounts
|
alias Memex.Accounts
|
||||||
alias MemexWeb.{Endpoint, FaqLive}
|
alias MemexWeb.{Endpoint, FaqLive}
|
||||||
|
|
||||||
@version Mix.Project.config()[:version]
|
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, _session, socket) do
|
||||||
admins = Accounts.list_users_by_role(:admin)
|
admins = Accounts.list_users_by_role(:admin)
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
navigate={Routes.live_path(Endpoint, FaqLive)}
|
navigate={Routes.live_path(Endpoint, FaqLive)}
|
||||||
class="link title text-primary-400 text-lg"
|
class="link title text-primary-400 text-lg"
|
||||||
>
|
>
|
||||||
<%= gettext("read more on how to use memEx") %>
|
<%= gettext("read more on how to use %{name}", name: "memEx") %>
|
||||||
</.link>
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -92,13 +92,15 @@
|
|||||||
<p>
|
<p>
|
||||||
<%= if @admins |> Enum.empty?() do %>
|
<%= if @admins |> Enum.empty?() do %>
|
||||||
<.link href={Routes.user_registration_path(Endpoint, :new)} class="link">
|
<.link href={Routes.user_registration_path(Endpoint, :new)} class="link">
|
||||||
<%= dgettext("prompts", "register to setup memEx") %>
|
<%= dgettext("prompts", "register to setup %{name}", name: "memEx") %>
|
||||||
</.link>
|
</.link>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="flex flex-wrap justify-center space-x-2">
|
<div class="flex flex-wrap justify-center space-x-2">
|
||||||
<a :for={%{email: email} <- @admins} class="link" href={"mailto:#{email}"}>
|
<%= for admin <- @admins do %>
|
||||||
<%= email %>
|
<a class="link" href={"mailto:#{admin.email}"}>
|
||||||
|
<%= admin.email %>
|
||||||
</a>
|
</a>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
@ -107,7 +109,8 @@
|
|||||||
<li class="flex flex-row justify-center space-x-2">
|
<li class="flex flex-row justify-center space-x-2">
|
||||||
<b><%= gettext("registration:") %></b>
|
<b><%= gettext("registration:") %></b>
|
||||||
<p>
|
<p>
|
||||||
<%= case Application.get_env(:memex, Memex.Accounts)[:registration] do
|
<%= Application.get_env(:memex, Endpoint)[:registration]
|
||||||
|
|> case do
|
||||||
"public" -> gettext("public signups")
|
"public" -> gettext("public signups")
|
||||||
_ -> gettext("invite only")
|
_ -> gettext("invite only")
|
||||||
end %>
|
end %>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
defmodule MemexWeb.InviteLive.FormComponent do
|
defmodule MemexWeb.InviteLive.FormComponent do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Livecomponent that can update or create an Memex.Accounts.Invite
|
Livecomponent that can update or create an Memex.Invites.Invite
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use MemexWeb, :live_component
|
use MemexWeb, :live_component
|
||||||
alias Ecto.Changeset
|
alias Ecto.Changeset
|
||||||
alias Memex.Accounts.{Invite, Invites, User}
|
alias Memex.{Accounts.User, Invites, Invites.Invite}
|
||||||
alias Phoenix.LiveView.Socket
|
alias Phoenix.LiveView.Socket
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@ -13,44 +13,23 @@ defmodule MemexWeb.InviteLive.FormComponent do
|
|||||||
%{:invite => Invite.t(), :current_user => User.t(), optional(any) => any},
|
%{:invite => Invite.t(), :current_user => User.t(), optional(any) => any},
|
||||||
Socket.t()
|
Socket.t()
|
||||||
) :: {:ok, Socket.t()}
|
) :: {:ok, Socket.t()}
|
||||||
def update(%{invite: _invite} = assigns, socket) do
|
def update(%{invite: invite} = assigns, socket) do
|
||||||
{:ok, socket |> assign(assigns) |> assign_changeset(%{})}
|
{:ok, socket |> assign(assigns) |> assign(:changeset, Invites.change_invite(invite))}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_event("validate", %{"invite" => invite_params}, socket) do
|
def handle_event(
|
||||||
{:noreply, socket |> assign_changeset(invite_params)}
|
"validate",
|
||||||
|
%{"invite" => invite_params},
|
||||||
|
%{assigns: %{invite: invite}} = socket
|
||||||
|
) do
|
||||||
|
{:noreply, socket |> assign(:changeset, invite |> Invites.change_invite(invite_params))}
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event("save", %{"invite" => invite_params}, %{assigns: %{action: action}} = socket) do
|
def handle_event("save", %{"invite" => invite_params}, %{assigns: %{action: action}} = socket) do
|
||||||
save_invite(socket, action, invite_params)
|
save_invite(socket, action, invite_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp assign_changeset(
|
|
||||||
%{assigns: %{action: action, current_user: user, invite: invite}} = socket,
|
|
||||||
invite_params
|
|
||||||
) do
|
|
||||||
changeset_action =
|
|
||||||
case action do
|
|
||||||
:new -> :insert
|
|
||||||
:edit -> :update
|
|
||||||
end
|
|
||||||
|
|
||||||
changeset =
|
|
||||||
case action do
|
|
||||||
:new -> Invite.create_changeset(user, "example_token", invite_params)
|
|
||||||
:edit -> invite |> Invite.update_changeset(invite_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
changeset =
|
|
||||||
case changeset |> Changeset.apply_action(changeset_action) do
|
|
||||||
{:ok, _data} -> changeset
|
|
||||||
{:error, changeset} -> changeset
|
|
||||||
end
|
|
||||||
|
|
||||||
socket |> assign(:changeset, changeset)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp save_invite(
|
defp save_invite(
|
||||||
%{assigns: %{current_user: current_user, invite: invite, return_to: return_to}} = socket,
|
%{assigns: %{current_user: current_user, invite: invite, return_to: return_to}} = socket,
|
||||||
:edit,
|
:edit,
|
||||||
@ -59,7 +38,9 @@ defmodule MemexWeb.InviteLive.FormComponent do
|
|||||||
socket =
|
socket =
|
||||||
case invite |> Invites.update_invite(invite_params, current_user) do
|
case invite |> Invites.update_invite(invite_params, current_user) do
|
||||||
{:ok, %{name: invite_name}} ->
|
{:ok, %{name: invite_name}} ->
|
||||||
prompt = dgettext("prompts", "%{name} updated successfully", name: invite_name)
|
prompt =
|
||||||
|
dgettext("prompts", "%{invite_name} updated successfully", invite_name: invite_name)
|
||||||
|
|
||||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||||
|
|
||||||
{:error, %Changeset{} = changeset} ->
|
{:error, %Changeset{} = changeset} ->
|
||||||
@ -77,7 +58,9 @@ defmodule MemexWeb.InviteLive.FormComponent do
|
|||||||
socket =
|
socket =
|
||||||
case current_user |> Invites.create_invite(invite_params) do
|
case current_user |> Invites.create_invite(invite_params) do
|
||||||
{:ok, %{name: invite_name}} ->
|
{:ok, %{name: invite_name}} ->
|
||||||
prompt = dgettext("prompts", "%{name} created successfully", name: invite_name)
|
prompt =
|
||||||
|
dgettext("prompts", "%{invite_name} created successfully", invite_name: invite_name)
|
||||||
|
|
||||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||||
|
|
||||||
{:error, %Changeset{} = changeset} ->
|
{:error, %Changeset{} = changeset} ->
|
||||||
|
@ -11,12 +11,11 @@
|
|||||||
phx-change="validate"
|
phx-change="validate"
|
||||||
phx-submit="save"
|
phx-submit="save"
|
||||||
>
|
>
|
||||||
<div
|
<%= if @changeset.action && not @changeset.valid? do %>
|
||||||
:if={@changeset.action && not @changeset.valid?()}
|
<div class="invalid-feedback col-span-3 text-center">
|
||||||
class="invalid-feedback col-span-3 text-center"
|
|
||||||
>
|
|
||||||
<%= changeset_errors(@changeset) %>
|
<%= changeset_errors(@changeset) %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-400") %>
|
<%= label(f, :name, gettext("Name"), class: "title text-lg text-primary-400") %>
|
||||||
<%= text_input(f, :name, class: "input input-primary col-span-2") %>
|
<%= text_input(f, :name, class: "input input-primary col-span-2") %>
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
defmodule MemexWeb.InviteLive.Index do
|
defmodule MemexWeb.InviteLive.Index do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Liveview to show a Memex.Accounts.Invite index
|
Liveview to show a Memex.Invites.Invite index
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use MemexWeb, :live_view
|
use MemexWeb, :live_view
|
||||||
import MemexWeb.Components.{InviteCard, UserCard}
|
import MemexWeb.Components.{InviteCard, UserCard}
|
||||||
alias Memex.Accounts
|
alias Memex.{Accounts, Invites, Invites.Invite}
|
||||||
alias Memex.Accounts.{Invite, Invites}
|
alias MemexWeb.HomeLive
|
||||||
alias MemexWeb.{Endpoint, HomeLive}
|
|
||||||
alias Phoenix.LiveView.JS
|
alias Phoenix.LiveView.JS
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@ -16,9 +15,9 @@ defmodule MemexWeb.InviteLive.Index do
|
|||||||
if current_user |> Map.get(:role) == :admin do
|
if current_user |> Map.get(:role) == :admin do
|
||||||
socket |> display_invites()
|
socket |> display_invites()
|
||||||
else
|
else
|
||||||
prompt = dgettext("errors", "you are not authorized to view this page")
|
prompt = dgettext("errors", "You are not authorized to view this page")
|
||||||
return_to = Routes.live_path(Endpoint, HomeLive)
|
return_to = Routes.live_path(Endpoint, HomeLive)
|
||||||
socket |> put_flash(:error, prompt) |> push_redirect(to: return_to)
|
socket |> put_flash(:error, prompt) |> push_navigate(to: return_to)
|
||||||
end
|
end
|
||||||
|
|
||||||
{:ok, socket}
|
{:ok, socket}
|
||||||
@ -62,7 +61,7 @@ defmodule MemexWeb.InviteLive.Index do
|
|||||||
) do
|
) do
|
||||||
socket =
|
socket =
|
||||||
Invites.get_invite!(id, current_user)
|
Invites.get_invite!(id, current_user)
|
||||||
|> Invites.update_invite(%{uses_left: nil}, current_user)
|
|> Invites.update_invite(%{"uses_left" => nil}, current_user)
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{name: invite_name}} ->
|
{:ok, %{name: invite_name}} ->
|
||||||
prompt =
|
prompt =
|
||||||
@ -84,7 +83,7 @@ defmodule MemexWeb.InviteLive.Index do
|
|||||||
) do
|
) do
|
||||||
socket =
|
socket =
|
||||||
Invites.get_invite!(id, current_user)
|
Invites.get_invite!(id, current_user)
|
||||||
|> Invites.update_invite(%{uses_left: nil, disabled_at: nil}, current_user)
|
|> Invites.update_invite(%{"uses_left" => nil, "disabled_at" => nil}, current_user)
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{name: invite_name}} ->
|
{:ok, %{name: invite_name}} ->
|
||||||
prompt =
|
prompt =
|
||||||
@ -108,7 +107,7 @@ defmodule MemexWeb.InviteLive.Index do
|
|||||||
|
|
||||||
socket =
|
socket =
|
||||||
Invites.get_invite!(id, current_user)
|
Invites.get_invite!(id, current_user)
|
||||||
|> Invites.update_invite(%{uses_left: 0, disabled_at: now}, current_user)
|
|> Invites.update_invite(%{"uses_left" => 0, "disabled_at" => now}, current_user)
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{name: invite_name}} ->
|
{:ok, %{name: invite_name}} ->
|
||||||
prompt =
|
prompt =
|
||||||
@ -124,8 +123,8 @@ defmodule MemexWeb.InviteLive.Index do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_event("copy_to_clipboard", _params, socket) do
|
def handle_event("copy_to_clipboard", _, socket) do
|
||||||
prompt = dgettext("prompts", "copied to clipboard")
|
prompt = dgettext("prompts", "Copied to clipboard")
|
||||||
{:noreply, socket |> put_flash(:info, prompt)}
|
{:noreply, socket |> put_flash(:info, prompt)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
||||||
<.invite_card :for={invite <- @invites} invite={invite} current_user={@current_user}>
|
<%= for invite <- @invites do %>
|
||||||
|
<.invite_card invite={invite}>
|
||||||
<:code_actions>
|
<:code_actions>
|
||||||
<form phx-submit="copy_to_clipboard">
|
<form phx-submit="copy_to_clipboard">
|
||||||
<button
|
<button
|
||||||
@ -53,17 +54,18 @@
|
|||||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||||
</.link>
|
</.link>
|
||||||
|
|
||||||
<a
|
<%= if invite.disabled_at |> is_nil() do %>
|
||||||
href="#"
|
<a href="#" class="btn btn-primary" phx-click="disable_invite" phx-value-id={invite.id}>
|
||||||
class="btn btn-primary"
|
<%= gettext("disable") %>
|
||||||
phx-click={if invite.disabled_at, do: "enable_invite", else: "disable_invite"}
|
|
||||||
phx-value-id={invite.id}
|
|
||||||
>
|
|
||||||
<%= if invite.disabled_at, do: gettext("enable"), else: gettext("disable") %>
|
|
||||||
</a>
|
</a>
|
||||||
|
<% else %>
|
||||||
|
<a href="#" class="btn btn-primary" phx-click="enable_invite" phx-value-id={invite.id}>
|
||||||
|
<%= gettext("enable") %>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= if invite.disabled_at |> is_nil() and not (invite.uses_left |> is_nil()) do %>
|
||||||
<a
|
<a
|
||||||
:if={invite.disabled_at |> is_nil() and not (invite.uses_left |> is_nil())}
|
|
||||||
href="#"
|
href="#"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
phx-click="set_unlimited"
|
phx-click="set_unlimited"
|
||||||
@ -76,7 +78,9 @@
|
|||||||
>
|
>
|
||||||
<%= gettext("set unlimited") %>
|
<%= gettext("set unlimited") %>
|
||||||
</a>
|
</a>
|
||||||
|
<% end %>
|
||||||
</.invite_card>
|
</.invite_card>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= unless @admins |> Enum.empty?() do %>
|
<%= unless @admins |> Enum.empty?() do %>
|
||||||
@ -87,7 +91,8 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
||||||
<.user_card :for={admin <- @admins} user={admin}>
|
<%= for admin <- @admins do %>
|
||||||
|
<.user_card user={admin}>
|
||||||
<.link
|
<.link
|
||||||
href="#"
|
href="#"
|
||||||
class="text-primary-400 link"
|
class="text-primary-400 link"
|
||||||
@ -104,6 +109,7 @@
|
|||||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||||
</.link>
|
</.link>
|
||||||
</.user_card>
|
</.user_card>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@ -115,7 +121,8 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
<div class="w-full flex flex-row flex-wrap justify-center items-center">
|
||||||
<.user_card :for={user <- @users} user={user}>
|
<%= for user <- @users do %>
|
||||||
|
<.user_card user={user}>
|
||||||
<.link
|
<.link
|
||||||
href="#"
|
href="#"
|
||||||
class="text-primary-400 link"
|
class="text-primary-400 link"
|
||||||
@ -132,11 +139,13 @@
|
|||||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||||
</.link>
|
</.link>
|
||||||
</.user_card>
|
</.user_card>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.invite_index_path(Endpoint, :index)}>
|
<%= if @live_action in [:new, :edit] do %>
|
||||||
|
<.modal return_to={Routes.invite_index_path(Endpoint, :index)}>
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.InviteLive.FormComponent}
|
module={MemexWeb.InviteLive.FormComponent}
|
||||||
id={@invite.id || :new}
|
id={@invite.id || :new}
|
||||||
@ -146,4 +155,5 @@
|
|||||||
return_to={Routes.invite_index_path(Endpoint, :index)}
|
return_to={Routes.invite_index_path(Endpoint, :index)}
|
||||||
current_user={@current_user}
|
current_user={@current_user}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
defmodule MemexWeb.LiveHelpers do
|
defmodule MemexWeb.LiveHelpers do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Contains common helper functions for liveviews
|
Contains resuable methods for all liveviews
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import Phoenix.Component
|
import Phoenix.Component
|
||||||
@ -31,7 +31,7 @@ defmodule MemexWeb.LiveHelpers do
|
|||||||
patch={@return_to}
|
patch={@return_to}
|
||||||
id="modal-bg"
|
id="modal-bg"
|
||||||
class="fade-in fixed z-10 left-0 top-0
|
class="fade-in fixed z-10 left-0 top-0
|
||||||
w-full h-full overflow-hidden
|
w-screen h-screen overflow-hidden
|
||||||
p-8 flex flex-col justify-center items-center cursor-auto"
|
p-8 flex flex-col justify-center items-center cursor-auto"
|
||||||
style="background-color: rgba(0,0,0,0.4);"
|
style="background-color: rgba(0,0,0,0.4);"
|
||||||
phx-remove={hide_modal()}
|
phx-remove={hide_modal()}
|
||||||
@ -63,7 +63,7 @@ defmodule MemexWeb.LiveHelpers do
|
|||||||
<i class="fa-fw fa-lg fas fa-times"></i>
|
<i class="fa-fw fa-lg fas fa-times"></i>
|
||||||
</.link>
|
</.link>
|
||||||
|
|
||||||
<div class="overflow-x-hidden overflow-y-auto w-full p-8 flex flex-col space-y-4 justify-start items-stretch">
|
<div class="overflow-x-hidden overflow-y-visible p-8 flex flex-col space-y-4 justify-start items-stretch">
|
||||||
<%= render_slot(@inner_block) %>
|
<%= render_slot(@inner_block) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -71,57 +71,10 @@ defmodule MemexWeb.LiveHelpers do
|
|||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
defp hide_modal(js \\ %JS{}) do
|
def hide_modal(js \\ %JS{}) do
|
||||||
js
|
js
|
||||||
|> JS.hide(to: "#modal", transition: "fade-out")
|
|> JS.hide(to: "#modal", transition: "fade-out")
|
||||||
|> JS.hide(to: "#modal-bg", transition: "fade-out")
|
|> JS.hide(to: "#modal-bg", transition: "fade-out")
|
||||||
|> JS.hide(to: "#modal-content", transition: "fade-out-scale")
|
|> JS.hide(to: "#modal-content", transition: "fade-out-scale")
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
|
||||||
A toggle button element that can be directed to a liveview or a
|
|
||||||
live_component's `handle_event/3`.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
<.toggle_button action="my_liveview_action" value={@some_value}>
|
|
||||||
<span>Toggle me!</span>
|
|
||||||
</.toggle_button>
|
|
||||||
<.toggle_button action="my_live_component_action" target={@myself} value={@some_value}>
|
|
||||||
<span>Whatever you want</span>
|
|
||||||
</.toggle_button>
|
|
||||||
"""
|
|
||||||
def toggle_button(assigns) do
|
|
||||||
assigns = assigns |> assign_new(:id, fn -> assigns.action end)
|
|
||||||
|
|
||||||
~H"""
|
|
||||||
<label for={@id} class="inline-flex relative items-center cursor-pointer">
|
|
||||||
<input
|
|
||||||
id={@id}
|
|
||||||
type="checkbox"
|
|
||||||
value={@value}
|
|
||||||
checked={@value}
|
|
||||||
class="sr-only peer"
|
|
||||||
data-qa={@id}
|
|
||||||
{
|
|
||||||
if assigns |> Map.has_key?(:target),
|
|
||||||
do: %{"phx-click": @action, "phx-value-value": @value, "phx-target": @target},
|
|
||||||
else: %{"phx-click": @action, "phx-value-value": @value}
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<div class="w-11 h-6 bg-gray-300 rounded-full peer
|
|
||||||
peer-focus:ring-4 peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800
|
|
||||||
peer-checked:bg-gray-600
|
|
||||||
peer-checked:after:translate-x-full peer-checked:after:border-white
|
|
||||||
after:content-[''] after:absolute after:top-1 after:left-[2px] after:bg-white after:border-gray-300
|
|
||||||
after:border after:rounded-full after:h-5 after:w-5
|
|
||||||
after:transition-all after:duration-250 after:ease-in-out
|
|
||||||
transition-colors duration-250 ease-in-out">
|
|
||||||
</div>
|
|
||||||
<span class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">
|
|
||||||
<%= render_slot(@inner_block) %>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
"""
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -30,15 +30,16 @@
|
|||||||
notes={@notes}
|
notes={@notes}
|
||||||
>
|
>
|
||||||
<:actions :let={note}>
|
<:actions :let={note}>
|
||||||
|
<%= if is_owner?(note, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner?(note, @current_user)}
|
|
||||||
patch={Routes.note_index_path(@socket, :edit, note.slug)}
|
patch={Routes.note_index_path(@socket, :edit, note.slug)}
|
||||||
data-qa={"note-edit-#{note.id}"}
|
data-qa={"note-edit-#{note.id}"}
|
||||||
>
|
>
|
||||||
<%= dgettext("actions", "edit") %>
|
<%= dgettext("actions", "edit") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<%= if is_owner_or_admin?(note, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner_or_admin?(note, @current_user)}
|
|
||||||
href="#"
|
href="#"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
phx-value-id={note.id}
|
phx-value-id={note.id}
|
||||||
@ -47,20 +48,20 @@
|
|||||||
>
|
>
|
||||||
<%= dgettext("actions", "delete") %>
|
<%= dgettext("actions", "delete") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</:actions>
|
</:actions>
|
||||||
</.live_component>
|
</.live_component>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<.link
|
<%= if @current_user do %>
|
||||||
:if={@current_user}
|
<.link patch={Routes.note_index_path(@socket, :new)} class="self-end btn btn-primary">
|
||||||
patch={Routes.note_index_path(@socket, :new)}
|
|
||||||
class="self-end btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "new note") %>
|
<%= dgettext("actions", "new note") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal :if={@live_action in [:new, :edit]} return_to={Routes.note_index_path(@socket, :index)}>
|
<%= if @live_action in [:new, :edit] do %>
|
||||||
|
<.modal return_to={Routes.note_index_path(@socket, :index)}>
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.NoteLive.FormComponent}
|
module={MemexWeb.NoteLive.FormComponent}
|
||||||
id={@note.id || :new}
|
id={@note.id || :new}
|
||||||
@ -70,4 +71,5 @@
|
|||||||
note={@note}
|
note={@note}
|
||||||
return_to={Routes.note_index_path(@socket, :index)}
|
return_to={Routes.note_index_path(@socket, :index)}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
@ -11,7 +11,7 @@ defmodule MemexWeb.NoteLive.Show do
|
|||||||
@impl true
|
@impl true
|
||||||
def handle_params(
|
def handle_params(
|
||||||
%{"slug" => slug},
|
%{"slug" => slug},
|
||||||
_params,
|
_,
|
||||||
%{assigns: %{live_action: live_action, current_user: current_user}} = socket
|
%{assigns: %{live_action: live_action, current_user: current_user}} = socket
|
||||||
) do
|
) do
|
||||||
note =
|
note =
|
||||||
|
@ -4,13 +4,11 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="flex flex-wrap space-x-1">
|
<div class="flex flex-wrap space-x-1">
|
||||||
<.link
|
<%= for tag <- @note.tags do %>
|
||||||
:for={tag <- @note.tags}
|
<.link navigate={Routes.note_index_path(Endpoint, :search, tag)} class="link">
|
||||||
navigate={Routes.note_index_path(Endpoint, :search, tag)}
|
|
||||||
class="link"
|
|
||||||
>
|
|
||||||
<%= tag %>
|
<%= tag %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.note_content note={@note} />
|
<.note_content note={@note} />
|
||||||
@ -23,15 +21,13 @@
|
|||||||
<.link class="btn btn-primary" navigate={Routes.note_index_path(@socket, :index)}>
|
<.link class="btn btn-primary" navigate={Routes.note_index_path(@socket, :index)}>
|
||||||
<%= dgettext("actions", "back") %>
|
<%= dgettext("actions", "back") %>
|
||||||
</.link>
|
</.link>
|
||||||
<.link
|
<%= if is_owner?(@note, @current_user) do %>
|
||||||
:if={is_owner?(@note, @current_user)}
|
<.link class="btn btn-primary" patch={Routes.note_show_path(@socket, :edit, @note.slug)}>
|
||||||
class="btn btn-primary"
|
|
||||||
patch={Routes.note_show_path(@socket, :edit, @note.slug)}
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "edit") %>
|
<%= dgettext("actions", "edit") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<%= if is_owner_or_admin?(@note, @current_user) do %>
|
||||||
<button
|
<button
|
||||||
:if={is_owner_or_admin?(@note, @current_user)}
|
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
@ -40,10 +36,12 @@
|
|||||||
>
|
>
|
||||||
<%= dgettext("actions", "delete") %>
|
<%= dgettext("actions", "delete") %>
|
||||||
</button>
|
</button>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal :if={@live_action == :edit} return_to={Routes.note_show_path(@socket, :show, @note.slug)}>
|
<%= if @live_action in [:edit] do %>
|
||||||
|
<.modal return_to={Routes.note_show_path(@socket, :show, @note.slug)}>
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.NoteLive.FormComponent}
|
module={MemexWeb.NoteLive.FormComponent}
|
||||||
id={@note.id}
|
id={@note.id}
|
||||||
@ -53,4 +51,5 @@
|
|||||||
note={@note}
|
note={@note}
|
||||||
return_to={Routes.note_show_path(@socket, :show, @note.slug)}
|
return_to={Routes.note_show_path(@socket, :show, @note.slug)}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
@ -30,15 +30,16 @@
|
|||||||
pipelines={@pipelines}
|
pipelines={@pipelines}
|
||||||
>
|
>
|
||||||
<:actions :let={pipeline}>
|
<:actions :let={pipeline}>
|
||||||
|
<%= if is_owner?(pipeline, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner?(pipeline, @current_user)}
|
|
||||||
patch={Routes.pipeline_index_path(@socket, :edit, pipeline.slug)}
|
patch={Routes.pipeline_index_path(@socket, :edit, pipeline.slug)}
|
||||||
data-qa={"pipeline-edit-#{pipeline.id}"}
|
data-qa={"pipeline-edit-#{pipeline.id}"}
|
||||||
>
|
>
|
||||||
<%= dgettext("actions", "edit") %>
|
<%= dgettext("actions", "edit") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<%= if is_owner_or_admin?(pipeline, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner_or_admin?(pipeline, @current_user)}
|
|
||||||
href="#"
|
href="#"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
phx-value-id={pipeline.id}
|
phx-value-id={pipeline.id}
|
||||||
@ -47,23 +48,20 @@
|
|||||||
>
|
>
|
||||||
<%= dgettext("actions", "delete") %>
|
<%= dgettext("actions", "delete") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</:actions>
|
</:actions>
|
||||||
</.live_component>
|
</.live_component>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<.link
|
<%= if @current_user do %>
|
||||||
:if={@current_user}
|
<.link patch={Routes.pipeline_index_path(@socket, :new)} class="self-end btn btn-primary">
|
||||||
patch={Routes.pipeline_index_path(@socket, :new)}
|
|
||||||
class="self-end btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "new pipeline") %>
|
<%= dgettext("actions", "new pipeline") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal
|
<%= if @live_action in [:new, :edit] do %>
|
||||||
:if={@live_action in [:new, :edit]}
|
<.modal return_to={Routes.pipeline_index_path(@socket, :index)}>
|
||||||
return_to={Routes.pipeline_index_path(@socket, :index)}
|
|
||||||
>
|
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.PipelineLive.FormComponent}
|
module={MemexWeb.PipelineLive.FormComponent}
|
||||||
id={@pipeline.id || :new}
|
id={@pipeline.id || :new}
|
||||||
@ -73,4 +71,5 @@
|
|||||||
pipeline={@pipeline}
|
pipeline={@pipeline}
|
||||||
return_to={Routes.pipeline_index_path(@socket, :index)}
|
return_to={Routes.pipeline_index_path(@socket, :index)}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
@ -4,17 +4,15 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="flex flex-wrap space-x-1">
|
<div class="flex flex-wrap space-x-1">
|
||||||
<.link
|
<%= for tag <- @pipeline.tags do %>
|
||||||
:for={tag <- @pipeline.tags}
|
<.link navigate={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link">
|
||||||
navigate={Routes.pipeline_index_path(Endpoint, :search, tag)}
|
|
||||||
class="link"
|
|
||||||
>
|
|
||||||
<%= tag %>
|
<%= tag %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= if @pipeline.description do %>
|
||||||
<textarea
|
<textarea
|
||||||
:if={@pipeline.description}
|
|
||||||
id="show-pipeline-description"
|
id="show-pipeline-description"
|
||||||
class="input input-primary h-32 min-h-32"
|
class="input input-primary h-32 min-h-32"
|
||||||
phx-hook="MaintainAttrs"
|
phx-hook="MaintainAttrs"
|
||||||
@ -22,6 +20,7 @@
|
|||||||
readonly
|
readonly
|
||||||
phx-no-format
|
phx-no-format
|
||||||
><%= @pipeline.description %></textarea>
|
><%= @pipeline.description %></textarea>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<p class="self-end">
|
<p class="self-end">
|
||||||
<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>
|
<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>
|
||||||
@ -31,15 +30,16 @@
|
|||||||
<.link class="btn btn-primary" navigate={Routes.pipeline_index_path(@socket, :index)}>
|
<.link class="btn btn-primary" navigate={Routes.pipeline_index_path(@socket, :index)}>
|
||||||
<%= dgettext("actions", "back") %>
|
<%= dgettext("actions", "back") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<%= if is_owner?(@pipeline, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner?(@pipeline, @current_user)}
|
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
|
patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)}
|
||||||
>
|
>
|
||||||
<%= dgettext("actions", "edit") %>
|
<%= dgettext("actions", "edit") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<%= if is_owner_or_admin?(@pipeline, @current_user) do %>
|
||||||
<button
|
<button
|
||||||
:if={is_owner_or_admin?(@pipeline, @current_user)}
|
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
@ -48,6 +48,7 @@
|
|||||||
>
|
>
|
||||||
<%= dgettext("actions", "delete") %>
|
<%= dgettext("actions", "delete") %>
|
||||||
</button>
|
</button>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="hr" />
|
<hr class="hr" />
|
||||||
@ -125,14 +126,15 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= if is_owner?(@pipeline, @current_user) do %>
|
||||||
<.link
|
<.link
|
||||||
:if={is_owner?(@pipeline, @current_user)}
|
|
||||||
class="self-end btn btn-primary"
|
class="self-end btn btn-primary"
|
||||||
patch={Routes.pipeline_show_path(@socket, :add_step, @pipeline.slug)}
|
patch={Routes.pipeline_show_path(@socket, :add_step, @pipeline.slug)}
|
||||||
data-qa={"add-step-#{@pipeline.id}"}
|
data-qa={"add-step-#{@pipeline.id}"}
|
||||||
>
|
>
|
||||||
<%= dgettext("actions", "add step") %>
|
<%= dgettext("actions", "add step") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= case @live_action do %>
|
<%= case @live_action do %>
|
||||||
@ -148,7 +150,20 @@
|
|||||||
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
|
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
|
||||||
/>
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
<% action when action in [:add_step, :edit_step] -> %>
|
<% :add_step -> %>
|
||||||
|
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
|
||||||
|
<.live_component
|
||||||
|
module={MemexWeb.StepLive.FormComponent}
|
||||||
|
id={@pipeline.id || :new}
|
||||||
|
current_user={@current_user}
|
||||||
|
title={@page_title}
|
||||||
|
action={@live_action}
|
||||||
|
pipeline={@pipeline}
|
||||||
|
step={@step}
|
||||||
|
return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}
|
||||||
|
/>
|
||||||
|
</.modal>
|
||||||
|
<% :edit_step -> %>
|
||||||
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
|
<.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}>
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MemexWeb.StepLive.FormComponent}
|
module={MemexWeb.StepLive.FormComponent}
|
||||||
|
@ -57,30 +57,6 @@ defmodule MemexWeb.Telemetry do
|
|||||||
"The time the connection spent waiting before being checked out for the query"
|
"The time the connection spent waiting before being checked out for the query"
|
||||||
),
|
),
|
||||||
|
|
||||||
# Oban Metrics
|
|
||||||
counter("oban.job.exception",
|
|
||||||
tags: [:queue, :worker],
|
|
||||||
event_name: [:oban, :job, :exception],
|
|
||||||
measurement: :duration,
|
|
||||||
description: "Number of oban jobs that raised an exception"
|
|
||||||
),
|
|
||||||
counter("oban.job.start",
|
|
||||||
tags: [:queue, :worker],
|
|
||||||
event_name: [:oban, :job, :start],
|
|
||||||
measurement: :system_time,
|
|
||||||
description: "Number of oban jobs started"
|
|
||||||
),
|
|
||||||
summary("oban.job.stop.duration",
|
|
||||||
tags: [:queue, :worker],
|
|
||||||
unit: {:native, :millisecond},
|
|
||||||
description: "Length of time spent processing the oban job"
|
|
||||||
),
|
|
||||||
summary("oban.job.stop.queue_time",
|
|
||||||
tags: [:queue, :worker],
|
|
||||||
unit: {:native, :millisecond},
|
|
||||||
description: "Time the oban job spent waiting in milliseconds"
|
|
||||||
),
|
|
||||||
|
|
||||||
# VM Metrics
|
# VM Metrics
|
||||||
summary("vm.memory.total", unit: {:byte, :kilobyte}),
|
summary("vm.memory.total", unit: {:byte, :kilobyte}),
|
||||||
summary("vm.total_run_queue_lengths.total"),
|
summary("vm.total_run_queue_lengths.total"),
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>
|
<title>
|
||||||
<%= dgettext("errors", "Error") %> | <%= gettext("memEx") %>
|
<%= dgettext("errors", "Error") %> | memEx
|
||||||
</title>
|
</title>
|
||||||
<link rel="stylesheet" href="/css/app.css" />
|
<link rel="stylesheet" href="/css/app.css" />
|
||||||
<script defer type="text/javascript" src="/js/app.js">
|
<script defer type="text/javascript" src="/js/app.js">
|
||||||
|
@ -3,12 +3,16 @@
|
|||||||
<.topbar current_user={assigns[:current_user]}></.topbar>
|
<.topbar current_user={assigns[:current_user]}></.topbar>
|
||||||
|
|
||||||
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
||||||
<p :if={get_flash(@conn, :info)} class="alert alert-info" role="alert">
|
<%= if get_flash(@conn, :info) do %>
|
||||||
|
<p class="alert alert-info" role="alert">
|
||||||
<%= get_flash(@conn, :info) %>
|
<%= get_flash(@conn, :info) %>
|
||||||
</p>
|
</p>
|
||||||
<p :if={get_flash(@conn, :error)} class="alert alert-danger" role="alert">
|
<% end %>
|
||||||
|
<%= if get_flash(@conn, :error) do %>
|
||||||
|
<p class="alert alert-danger" role="alert">
|
||||||
<%= get_flash(@conn, :error) %>
|
<%= get_flash(@conn, :error) %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
@ -3,18 +3,14 @@
|
|||||||
<.topbar current_user={assigns[:current_user]}></.topbar>
|
<.topbar current_user={assigns[:current_user]}></.topbar>
|
||||||
|
|
||||||
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
<div class="mx-8 my-2 flex flex-col space-y-4 text-center">
|
||||||
<p
|
<%= if @flash && @flash |> Map.has_key?("info") do %>
|
||||||
:if={@flash && @flash |> Map.has_key?("info")}
|
<p class="alert alert-info" role="alert" phx-click="lv:clear-flash" phx-value-key="info">
|
||||||
class="alert alert-info"
|
|
||||||
role="alert"
|
|
||||||
phx-click="lv:clear-flash"
|
|
||||||
phx-value-key="info"
|
|
||||||
>
|
|
||||||
<%= live_flash(@flash, "info") %>
|
<%= live_flash(@flash, "info") %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= if @flash && @flash |> Map.has_key?("error") do %>
|
||||||
<p
|
<p
|
||||||
:if={@flash && @flash |> Map.has_key?("error")}
|
|
||||||
class="alert alert-danger"
|
class="alert alert-danger"
|
||||||
role="alert"
|
role="alert"
|
||||||
phx-click="lv:clear-flash"
|
phx-click="lv:clear-flash"
|
||||||
@ -22,6 +18,7 @@
|
|||||||
>
|
>
|
||||||
<%= live_flash(@flash, "error") %>
|
<%= live_flash(@flash, "error") %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
||||||
<h1 class="title text-primary-400 text-xl">
|
<h1 class="title text-primary-400 text-xl">
|
||||||
<%= dgettext("actions", "Resend confirmation instructions") %>
|
<%= dgettext("actions", "Resend confirmation instructions") %>
|
||||||
</h1>
|
</h1>
|
||||||
@ -20,13 +20,11 @@
|
|||||||
<hr class="hr" />
|
<hr class="hr" />
|
||||||
|
|
||||||
<div class="flex flex-row justify-center items-center space-x-4">
|
<div class="flex flex-row justify-center items-center space-x-4">
|
||||||
<.link
|
<%= if Accounts.allow_registration?() do %>
|
||||||
:if={Accounts.allow_registration?()}
|
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||||
href={Routes.user_registration_path(@conn, :new)}
|
|
||||||
class="btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "register") %>
|
<%= dgettext("actions", "register") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
||||||
<%= dgettext("actions", "log in") %>
|
<%= dgettext("actions", "log in") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
||||||
<h1 class="title text-primary-400 text-xl">
|
<h1 class="title text-primary-400 text-xl">
|
||||||
<%= dgettext("actions", "register") %>
|
<%= dgettext("actions", "register") %>
|
||||||
</h1>
|
</h1>
|
||||||
@ -9,12 +9,16 @@
|
|||||||
action={Routes.user_registration_path(@conn, :create)}
|
action={Routes.user_registration_path(@conn, :create)}
|
||||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||||
>
|
>
|
||||||
<p :if={@changeset.action && not @changeset.valid?()} class="alert alert-danger col-span-3">
|
<%= if @changeset.action && not @changeset.valid? do %>
|
||||||
<%= dgettext("errors", "oops, something went wrong! please check the errors below.") %>
|
<div class="alert alert-danger col-span-3">
|
||||||
|
<p>
|
||||||
|
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= if @invite_token do %>
|
<%= if @invite do %>
|
||||||
<%= hidden_input(f, :invite_token, value: @invite_token) %>
|
<%= hidden_input(f, :invite_token, value: @invite.token) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= label(f, :email, class: "title text-lg text-primary-400") %>
|
<%= label(f, :email, class: "title text-lg text-primary-400") %>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
||||||
<h1 class="title text-primary-400 text-xl">
|
<h1 class="title text-primary-400 text-xl">
|
||||||
<%= dgettext("actions", "Reset password") %>
|
<%= dgettext("actions", "Reset password") %>
|
||||||
</h1>
|
</h1>
|
||||||
@ -9,11 +9,13 @@
|
|||||||
action={Routes.user_reset_password_path(@conn, :update, @token)}
|
action={Routes.user_reset_password_path(@conn, :update, @token)}
|
||||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||||
>
|
>
|
||||||
<div :if={@changeset.action && not @changeset.valid?()} class="alert alert-danger col-span-3">
|
<%= if @changeset.action && not @changeset.valid? do %>
|
||||||
|
<div class="alert alert-danger col-span-3">
|
||||||
<p>
|
<p>
|
||||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= label(f, :password, "new password", class: "title text-lg text-primary-400") %>
|
<%= label(f, :password, "new password", class: "title text-lg text-primary-400") %>
|
||||||
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
|
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
|
||||||
@ -36,13 +38,11 @@
|
|||||||
<hr class="hr" />
|
<hr class="hr" />
|
||||||
|
|
||||||
<div class="flex flex-row justify-center items-center space-x-4">
|
<div class="flex flex-row justify-center items-center space-x-4">
|
||||||
<.link
|
<%= if Accounts.allow_registration?() do %>
|
||||||
:if={Accounts.allow_registration?()}
|
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||||
href={Routes.user_registration_path(@conn, :new)}
|
|
||||||
class="btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "register") %>
|
<%= dgettext("actions", "register") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
||||||
<%= dgettext("actions", "log in") %>
|
<%= dgettext("actions", "log in") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
||||||
<h1 class="title text-primary-400 text-xl">
|
<h1 class="title text-primary-400 text-xl">
|
||||||
<%= dgettext("actions", "forgot your password?") %>
|
<%= dgettext("actions", "forgot your password?") %>
|
||||||
</h1>
|
</h1>
|
||||||
@ -20,13 +20,11 @@
|
|||||||
<hr class="hr" />
|
<hr class="hr" />
|
||||||
|
|
||||||
<div class="flex flex-row justify-center items-center space-x-4">
|
<div class="flex flex-row justify-center items-center space-x-4">
|
||||||
<.link
|
<%= if Accounts.allow_registration?() do %>
|
||||||
:if={Accounts.allow_registration?()}
|
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||||
href={Routes.user_registration_path(@conn, :new)}
|
|
||||||
class="btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "register") %>
|
<%= dgettext("actions", "register") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
<.link href={Routes.user_session_path(@conn, :new)} class="btn btn-primary">
|
||||||
<%= dgettext("actions", "log in") %>
|
<%= dgettext("actions", "log in") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center space-y-4">
|
||||||
<h1 class="title text-primary-400 text-xl">
|
<h1 class="title text-primary-400 text-xl">
|
||||||
<%= dgettext("actions", "log in") %>
|
<%= dgettext("actions", "log in") %>
|
||||||
</h1>
|
</h1>
|
||||||
@ -10,11 +10,13 @@
|
|||||||
as="user"
|
as="user"
|
||||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||||
>
|
>
|
||||||
<div :if={@error_message} class="alert alert-danger col-span-3">
|
<%= if @error_message do %>
|
||||||
|
<div class="alert alert-danger col-span-3">
|
||||||
<p>
|
<p>
|
||||||
<%= @error_message %>
|
<%= @error_message %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= label(f, :email, class: "title text-lg text-primary-400") %>
|
<%= label(f, :email, class: "title text-lg text-primary-400") %>
|
||||||
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
|
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
|
||||||
@ -33,13 +35,11 @@
|
|||||||
<hr class="hr" />
|
<hr class="hr" />
|
||||||
|
|
||||||
<div class="flex flex-row justify-center items-center space-x-4">
|
<div class="flex flex-row justify-center items-center space-x-4">
|
||||||
<.link
|
<%= if Accounts.allow_registration?() do %>
|
||||||
:if={Accounts.allow_registration?()}
|
<.link href={Routes.user_registration_path(@conn, :new)} class="btn btn-primary">
|
||||||
href={Routes.user_registration_path(@conn, :new)}
|
|
||||||
class="btn btn-primary"
|
|
||||||
>
|
|
||||||
<%= dgettext("actions", "register") %>
|
<%= dgettext("actions", "register") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
<% end %>
|
||||||
<.link href={Routes.user_reset_password_path(@conn, :new)} class="btn btn-primary">
|
<.link href={Routes.user_reset_password_path(@conn, :new)} class="btn btn-primary">
|
||||||
<%= dgettext("actions", "forgot your password?") %>
|
<%= dgettext("actions", "forgot your password?") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-auto pb-8 max-w-2xl flex flex-col justify-center items-center text-center space-y-4">
|
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center text-center space-y-4">
|
||||||
<h1 class="pb-4 title text-primary-400 text-xl">
|
<h1 class="pb-4 title text-primary-400 text-xl">
|
||||||
<%= gettext("settings") %>
|
<%= gettext("settings") %>
|
||||||
</h1>
|
</h1>
|
||||||
@ -15,14 +15,13 @@
|
|||||||
<%= dgettext("actions", "change email") %>
|
<%= dgettext("actions", "change email") %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div
|
<%= if @email_changeset.action && not @email_changeset.valid? do %>
|
||||||
:if={@email_changeset.action && not @email_changeset.valid?()}
|
<div class="alert alert-danger col-span-3">
|
||||||
class="alert alert-danger col-span-3"
|
|
||||||
>
|
|
||||||
<p>
|
<p>
|
||||||
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
|
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
|
||||||
|
|
||||||
@ -59,14 +58,13 @@
|
|||||||
<%= dgettext("actions", "change password") %>
|
<%= dgettext("actions", "change password") %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div
|
<%= if @password_changeset.action && not @password_changeset.valid? do %>
|
||||||
:if={@password_changeset.action && not @password_changeset.valid?()}
|
<div class="alert alert-danger col-span-3">
|
||||||
class="alert alert-danger col-span-3"
|
|
||||||
>
|
|
||||||
<p>
|
<p>
|
||||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
|
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
|
||||||
|
|
||||||
@ -115,14 +113,13 @@
|
|||||||
<%= dgettext("actions", "change language") %>
|
<%= dgettext("actions", "change language") %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div
|
<%= if @locale_changeset.action && not @locale_changeset.valid? do %>
|
||||||
:if={@locale_changeset.action && not @locale_changeset.valid?()}
|
<div class="alert alert-danger">
|
||||||
class="alert alert-danger"
|
|
||||||
>
|
|
||||||
<p>
|
<p>
|
||||||
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
|
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ defmodule MemexWeb.EmailView do
|
|||||||
@moduledoc """
|
@moduledoc """
|
||||||
A view for email-related helper functions
|
A view for email-related helper functions
|
||||||
"""
|
"""
|
||||||
use MemexWeb, :view
|
|
||||||
alias MemexWeb.HomeLive
|
alias MemexWeb.HomeLive
|
||||||
|
|
||||||
|
use MemexWeb, :view
|
||||||
end
|
end
|
||||||
|
@ -17,13 +17,11 @@ defmodule MemexWeb.ErrorHelpers do
|
|||||||
assigns = %{extra_class: extra_class, form: form, field: field}
|
assigns = %{extra_class: extra_class, form: form, field: field}
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<span
|
<%= for error <- Keyword.get_values(@form.errors, @field) do %>
|
||||||
:for={error <- Keyword.get_values(@form.errors, @field)}
|
<span class={["invalid-feedback", @extra_class]} phx-feedback-for={input_name(@form, @field)}>
|
||||||
class={["invalid-feedback", @extra_class]}
|
|
||||||
phx-feedback-for={input_name(@form, @field)}
|
|
||||||
>
|
|
||||||
<%= translate_error(error) %>
|
<%= translate_error(error) %>
|
||||||
</span>
|
</span>
|
||||||
|
<% end %>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ defmodule MemexWeb.ErrorView do
|
|||||||
case error_path do
|
case error_path do
|
||||||
"404.html" -> dgettext("errors", "not found")
|
"404.html" -> dgettext("errors", "not found")
|
||||||
"401.html" -> dgettext("errors", "unauthorized")
|
"401.html" -> dgettext("errors", "unauthorized")
|
||||||
_other_path -> dgettext("errors", "internal server error")
|
_ -> dgettext("errors", "internal server error")
|
||||||
end
|
end
|
||||||
|
|
||||||
render("error.html", %{error_string: error_string})
|
render("error.html", %{error_string: error_string})
|
||||||
|
@ -7,11 +7,6 @@ defmodule MemexWeb.LayoutView do
|
|||||||
# so we instruct Elixir to not warn if the dashboard route is missing.
|
# so we instruct Elixir to not warn if the dashboard route is missing.
|
||||||
@compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}}
|
@compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}}
|
||||||
|
|
||||||
def get_title(%{assigns: %{title: title}}) do
|
def get_title(%{assigns: %{title: title}}), do: gettext("memEx | %{title}", title: title)
|
||||||
gettext("memEx | %{title}", title: title)
|
def get_title(_conn), do: gettext("memEx")
|
||||||
end
|
|
||||||
|
|
||||||
def get_title(_conn) do
|
|
||||||
gettext("memEx")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -16,8 +16,8 @@ defmodule MemexWeb.ViewHelpers do
|
|||||||
|
|
||||||
def datetime(assigns) do
|
def datetime(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
|
<%= if @datetime do %>
|
||||||
<time
|
<time
|
||||||
:if={@datetime}
|
|
||||||
datetime={cast_datetime(@datetime)}
|
datetime={cast_datetime(@datetime)}
|
||||||
x-data={"{
|
x-data={"{
|
||||||
datetime:
|
datetime:
|
||||||
@ -28,6 +28,7 @@ defmodule MemexWeb.ViewHelpers do
|
|||||||
>
|
>
|
||||||
<%= cast_datetime(@datetime) %>
|
<%= cast_datetime(@datetime) %>
|
||||||
</time>
|
</time>
|
||||||
|
<% end %>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -47,8 +48,8 @@ defmodule MemexWeb.ViewHelpers do
|
|||||||
|
|
||||||
def date(assigns) do
|
def date(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
|
<%= if @date do %>
|
||||||
<time
|
<time
|
||||||
:if={@date}
|
|
||||||
datetime={@date |> Date.to_iso8601(:extended)}
|
datetime={@date |> Date.to_iso8601(:extended)}
|
||||||
x-data={"{
|
x-data={"{
|
||||||
date:
|
date:
|
||||||
@ -59,6 +60,7 @@ defmodule MemexWeb.ViewHelpers do
|
|||||||
>
|
>
|
||||||
<%= @date |> Date.to_iso8601(:extended) %>
|
<%= @date |> Date.to_iso8601(:extended) %>
|
||||||
</time>
|
</time>
|
||||||
|
<% end %>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
4
mix.exs
4
mix.exs
@ -4,7 +4,7 @@ defmodule Memex.MixProject do
|
|||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :memex,
|
app: :memex,
|
||||||
version: "0.1.8",
|
version: "0.1.7",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: Mix.compilers(),
|
compilers: Mix.compilers(),
|
||||||
@ -34,7 +34,7 @@ defmodule Memex.MixProject do
|
|||||||
def application do
|
def application do
|
||||||
[
|
[
|
||||||
mod: {Memex.Application, []},
|
mod: {Memex.Application, []},
|
||||||
extra_applications: [:logger, :runtime_tools, :os_mon, :crypto]
|
extra_applications: [:logger, :runtime_tools, :os_mon]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:29
|
#: lib/memex_web/live/invite_live/index.html.heex:30
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Copy to clipboard"
|
msgid "Copy to clipboard"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -22,30 +22,30 @@ msgid "Resend confirmation instructions"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:3
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:3
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:31
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:33
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Reset password"
|
msgid "Reset password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:29
|
#: lib/memex_web/live/invite_live/form_component.html.heex:28
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Save"
|
msgid "Save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:15
|
#: lib/memex_web/templates/user_settings/edit.html.heex:15
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:45
|
#: lib/memex_web/templates/user_settings/edit.html.heex:44
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "change email"
|
msgid "change email"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:115
|
#: lib/memex_web/templates/user_settings/edit.html.heex:113
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:134
|
#: lib/memex_web/templates/user_settings/edit.html.heex:131
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "change language"
|
msgid "change language"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:59
|
#: lib/memex_web/templates/user_settings/edit.html.heex:58
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:101
|
#: lib/memex_web/templates/user_settings/edit.html.heex:99
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "change password"
|
msgid "change password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -55,29 +55,29 @@ msgstr ""
|
|||||||
msgid "create invite"
|
msgid "create invite"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:48
|
#: lib/memex_web/live/context_live/index.html.heex:49
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:41
|
#: lib/memex_web/live/context_live/show.html.heex:40
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:48
|
#: lib/memex_web/live/note_live/index.html.heex:49
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:41
|
#: lib/memex_web/live/note_live/show.html.heex:37
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:48
|
#: lib/memex_web/live/pipeline_live/index.html.heex:49
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:49
|
#: lib/memex_web/live/pipeline_live/show.html.heex:49
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:118
|
#: lib/memex_web/live/pipeline_live/show.html.heex:119
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "delete"
|
msgid "delete"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:157
|
#: lib/memex_web/templates/user_settings/edit.html.heex:154
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "delete user"
|
msgid "delete user"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:38
|
#: lib/memex_web/live/context_live/index.html.heex:38
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:31
|
#: lib/memex_web/live/context_live/show.html.heex:29
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:38
|
#: lib/memex_web/live/note_live/index.html.heex:38
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:31
|
#: lib/memex_web/live/note_live/show.html.heex:26
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:38
|
#: lib/memex_web/live/pipeline_live/index.html.heex:38
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:39
|
#: lib/memex_web/live/pipeline_live/show.html.heex:38
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:107
|
#: lib/memex_web/live/pipeline_live/show.html.heex:108
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "edit"
|
msgid "edit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -87,39 +87,39 @@ msgstr ""
|
|||||||
msgid "invite someone new!"
|
msgid "invite someone new!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:124
|
#: lib/memex_web/components/topbar.ex:125
|
||||||
#: lib/memex_web/templates/user_confirmation/new.html.heex:31
|
#: lib/memex_web/templates/user_confirmation/new.html.heex:29
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:44
|
#: lib/memex_web/templates/user_registration/new.html.heex:48
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:47
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:47
|
||||||
#: lib/memex_web/templates/user_reset_password/new.html.heex:31
|
#: lib/memex_web/templates/user_reset_password/new.html.heex:29
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:3
|
#: lib/memex_web/templates/user_session/new.html.heex:3
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:30
|
#: lib/memex_web/templates/user_session/new.html.heex:32
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "log in"
|
msgid "log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:59
|
#: lib/memex_web/live/context_live/index.html.heex:58
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new context"
|
msgid "new context"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:59
|
#: lib/memex_web/live/note_live/index.html.heex:58
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new note"
|
msgid "new note"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:59
|
#: lib/memex_web/live/pipeline_live/index.html.heex:58
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new pipeline"
|
msgid "new pipeline"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:115
|
#: lib/memex_web/components/topbar.ex:115
|
||||||
#: lib/memex_web/templates/user_confirmation/new.html.heex:28
|
#: lib/memex_web/templates/user_confirmation/new.html.heex:25
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:3
|
#: lib/memex_web/templates/user_registration/new.html.heex:3
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:37
|
#: lib/memex_web/templates/user_registration/new.html.heex:41
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:44
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:43
|
||||||
#: lib/memex_web/templates/user_reset_password/new.html.heex:28
|
#: lib/memex_web/templates/user_reset_password/new.html.heex:25
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:41
|
#: lib/memex_web/templates/user_session/new.html.heex:40
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "register"
|
msgid "register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -132,19 +132,19 @@ msgstr ""
|
|||||||
msgid "save"
|
msgid "save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:24
|
#: lib/memex_web/live/context_live/show.html.heex:22
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:24
|
#: lib/memex_web/live/note_live/show.html.heex:22
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:32
|
#: lib/memex_web/live/pipeline_live/show.html.heex:31
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "back"
|
msgid "back"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:134
|
#: lib/memex_web/live/pipeline_live/show.html.heex:135
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "add step"
|
msgid "add step"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:47
|
#: lib/memex_web/templates/user_registration/new.html.heex:51
|
||||||
#: lib/memex_web/templates/user_reset_password/new.html.heex:3
|
#: lib/memex_web/templates/user_reset_password/new.html.heex:3
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:44
|
#: lib/memex_web/templates/user_session/new.html.heex:44
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
@ -156,7 +156,7 @@ msgstr ""
|
|||||||
msgid "send instructions to reset password"
|
msgid "send instructions to reset password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:148
|
#: lib/memex_web/templates/user_settings/edit.html.heex:145
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "export data as json"
|
msgid "export data as json"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -10,7 +10,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:29
|
#: lib/memex_web/live/invite_live/index.html.heex:30
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Copy to clipboard"
|
msgid "Copy to clipboard"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -22,30 +22,30 @@ msgid "Resend confirmation instructions"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:3
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:3
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:31
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:33
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Reset password"
|
msgid "Reset password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:29
|
#: lib/memex_web/live/invite_live/form_component.html.heex:28
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Save"
|
msgid "Save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:15
|
#: lib/memex_web/templates/user_settings/edit.html.heex:15
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:45
|
#: lib/memex_web/templates/user_settings/edit.html.heex:44
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "change email"
|
msgid "change email"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:115
|
#: lib/memex_web/templates/user_settings/edit.html.heex:113
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:134
|
#: lib/memex_web/templates/user_settings/edit.html.heex:131
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "change language"
|
msgid "change language"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:59
|
#: lib/memex_web/templates/user_settings/edit.html.heex:58
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:101
|
#: lib/memex_web/templates/user_settings/edit.html.heex:99
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "change password"
|
msgid "change password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -55,29 +55,29 @@ msgstr ""
|
|||||||
msgid "create invite"
|
msgid "create invite"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:48
|
#: lib/memex_web/live/context_live/index.html.heex:49
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:41
|
#: lib/memex_web/live/context_live/show.html.heex:40
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:48
|
#: lib/memex_web/live/note_live/index.html.heex:49
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:41
|
#: lib/memex_web/live/note_live/show.html.heex:37
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:48
|
#: lib/memex_web/live/pipeline_live/index.html.heex:49
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:49
|
#: lib/memex_web/live/pipeline_live/show.html.heex:49
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:118
|
#: lib/memex_web/live/pipeline_live/show.html.heex:119
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "delete"
|
msgid "delete"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:157
|
#: lib/memex_web/templates/user_settings/edit.html.heex:154
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "delete user"
|
msgid "delete user"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:38
|
#: lib/memex_web/live/context_live/index.html.heex:38
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:31
|
#: lib/memex_web/live/context_live/show.html.heex:29
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:38
|
#: lib/memex_web/live/note_live/index.html.heex:38
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:31
|
#: lib/memex_web/live/note_live/show.html.heex:26
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:38
|
#: lib/memex_web/live/pipeline_live/index.html.heex:38
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:39
|
#: lib/memex_web/live/pipeline_live/show.html.heex:38
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:107
|
#: lib/memex_web/live/pipeline_live/show.html.heex:108
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "edit"
|
msgid "edit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -87,39 +87,39 @@ msgstr ""
|
|||||||
msgid "invite someone new!"
|
msgid "invite someone new!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:124
|
#: lib/memex_web/components/topbar.ex:125
|
||||||
#: lib/memex_web/templates/user_confirmation/new.html.heex:31
|
#: lib/memex_web/templates/user_confirmation/new.html.heex:29
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:44
|
#: lib/memex_web/templates/user_registration/new.html.heex:48
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:47
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:47
|
||||||
#: lib/memex_web/templates/user_reset_password/new.html.heex:31
|
#: lib/memex_web/templates/user_reset_password/new.html.heex:29
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:3
|
#: lib/memex_web/templates/user_session/new.html.heex:3
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:30
|
#: lib/memex_web/templates/user_session/new.html.heex:32
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "log in"
|
msgid "log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:59
|
#: lib/memex_web/live/context_live/index.html.heex:58
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new context"
|
msgid "new context"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:59
|
#: lib/memex_web/live/note_live/index.html.heex:58
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new note"
|
msgid "new note"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:59
|
#: lib/memex_web/live/pipeline_live/index.html.heex:58
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new pipeline"
|
msgid "new pipeline"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:115
|
#: lib/memex_web/components/topbar.ex:115
|
||||||
#: lib/memex_web/templates/user_confirmation/new.html.heex:28
|
#: lib/memex_web/templates/user_confirmation/new.html.heex:25
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:3
|
#: lib/memex_web/templates/user_registration/new.html.heex:3
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:37
|
#: lib/memex_web/templates/user_registration/new.html.heex:41
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:44
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:43
|
||||||
#: lib/memex_web/templates/user_reset_password/new.html.heex:28
|
#: lib/memex_web/templates/user_reset_password/new.html.heex:25
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:41
|
#: lib/memex_web/templates/user_session/new.html.heex:40
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "register"
|
msgid "register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -132,19 +132,19 @@ msgstr ""
|
|||||||
msgid "save"
|
msgid "save"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:24
|
#: lib/memex_web/live/context_live/show.html.heex:22
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:24
|
#: lib/memex_web/live/note_live/show.html.heex:22
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:32
|
#: lib/memex_web/live/pipeline_live/show.html.heex:31
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "back"
|
msgid "back"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:134
|
#: lib/memex_web/live/pipeline_live/show.html.heex:135
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "add step"
|
msgid "add step"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:47
|
#: lib/memex_web/templates/user_registration/new.html.heex:51
|
||||||
#: lib/memex_web/templates/user_reset_password/new.html.heex:3
|
#: lib/memex_web/templates/user_reset_password/new.html.heex:3
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:44
|
#: lib/memex_web/templates/user_session/new.html.heex:44
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
@ -156,7 +156,7 @@ msgstr ""
|
|||||||
msgid "send instructions to reset password"
|
msgid "send instructions to reset password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:148
|
#: lib/memex_web/templates/user_settings/edit.html.heex:145
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "export data as json"
|
msgid "export data as json"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -21,7 +21,7 @@ msgstr ""
|
|||||||
## Run "mix gettext.extract" to bring this file up to
|
## Run "mix gettext.extract" to bring this file up to
|
||||||
## date. Leave "msgstr"s empty as changing them here has no
|
## date. Leave "msgstr"s empty as changing them here has no
|
||||||
## effect: edit them in PO (.po) files instead.
|
## effect: edit them in PO (.po) files instead.
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:86
|
#: lib/memex_web/live/invite_live/index.html.heex:90
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Admins"
|
msgid "Admins"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -31,17 +31,17 @@ msgstr ""
|
|||||||
msgid "Confirm your account"
|
msgid "Confirm your account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:25
|
#: lib/memex_web/templates/user_session/new.html.heex:27
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Keep me logged in for 60 days"
|
msgid "Keep me logged in for 60 days"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:21
|
#: lib/memex_web/live/invite_live/form_component.html.heex:20
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/layout/live.html.heex:43
|
#: lib/memex_web/templates/layout/live.html.heex:40
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Reconnecting..."
|
msgid "Reconnecting..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -51,14 +51,19 @@ msgstr ""
|
|||||||
msgid "Reset your password"
|
msgid "Reset your password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:25
|
#: lib/memex_web/controllers/user_settings_controller.ex:10
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/form_component.html.heex:24
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Uses left"
|
msgid "Uses left"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:19
|
#: lib/memex_web/live/context_live/show.html.heex:17
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:19
|
#: lib/memex_web/live/note_live/show.html.heex:17
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:27
|
#: lib/memex_web/live/pipeline_live/show.html.heex:26
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Visibility: %{visibility}"
|
msgid "Visibility: %{visibility}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -78,7 +83,7 @@ msgstr ""
|
|||||||
msgid "built with sharing and collaboration in mind"
|
msgid "built with sharing and collaboration in mind"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:80
|
#: lib/memex_web/templates/user_settings/edit.html.heex:78
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "confirm new password"
|
msgid "confirm new password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -106,13 +111,13 @@ msgstr ""
|
|||||||
msgid "convenient:"
|
msgid "convenient:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:33
|
#: lib/memex_web/templates/user_settings/edit.html.heex:32
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:89
|
#: lib/memex_web/templates/user_settings/edit.html.heex:87
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "current password"
|
msgid "current password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:62
|
#: lib/memex_web/live/invite_live/index.html.heex:59
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "disable"
|
msgid "disable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -127,12 +132,12 @@ msgstr ""
|
|||||||
msgid "document your processes, attaching contexts to each step"
|
msgid "document your processes, attaching contexts to each step"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:34
|
#: lib/memex_web/live/invite_live/index.ex:33
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "edit invite"
|
msgid "edit invite"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:29
|
#: lib/memex_web/templates/user_settings/edit.html.heex:28
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "email"
|
msgid "email"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -142,13 +147,13 @@ msgstr ""
|
|||||||
msgid "email unconfirmed"
|
msgid "email unconfirmed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:62
|
#: lib/memex_web/live/invite_live/index.html.heex:63
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "enable"
|
msgid "enable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:32
|
#: lib/memex_web/templates/user_registration/new.html.heex:36
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:129
|
#: lib/memex_web/templates/user_settings/edit.html.heex:126
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "english"
|
msgid "english"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -158,12 +163,12 @@ msgstr ""
|
|||||||
msgid "features"
|
msgid "features"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:135
|
#: lib/memex_web/live/home_live.html.heex:138
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "get involved!"
|
msgid "get involved!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:156
|
#: lib/memex_web/live/home_live.html.heex:159
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "help translate"
|
msgid "help translate"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -173,18 +178,18 @@ msgstr ""
|
|||||||
msgid "instance information"
|
msgid "instance information"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:42
|
#: lib/memex_web/components/invite_card.ex:32
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invite disabled"
|
msgid "invite disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:112
|
#: lib/memex_web/live/home_live.html.heex:115
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invite only"
|
msgid "invite only"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:73
|
#: lib/memex_web/components/topbar.ex:74
|
||||||
#: lib/memex_web/live/invite_live/index.ex:42
|
#: lib/memex_web/live/invite_live/index.ex:41
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:3
|
#: lib/memex_web/live/invite_live/index.html.heex:3
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invites"
|
msgid "invites"
|
||||||
@ -200,12 +205,12 @@ msgstr ""
|
|||||||
msgid "multi-user:"
|
msgid "multi-user:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:38
|
#: lib/memex_web/live/invite_live/index.ex:37
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new invite"
|
msgid "new invite"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:73
|
#: lib/memex_web/templates/user_settings/edit.html.heex:71
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new password"
|
msgid "new password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -261,22 +266,22 @@ msgstr ""
|
|||||||
msgid "provide context around a single topic and hotlink to your notes"
|
msgid "provide context around a single topic and hotlink to your notes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:111
|
#: lib/memex_web/live/home_live.html.heex:114
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "public signups"
|
msgid "public signups"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:32
|
#: lib/memex_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "register"
|
msgid "register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:108
|
#: lib/memex_web/live/home_live.html.heex:110
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "registration:"
|
msgid "registration:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:167
|
#: lib/memex_web/live/home_live.html.heex:170
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "report bugs or request features"
|
msgid "report bugs or request features"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -296,12 +301,11 @@ msgstr ""
|
|||||||
msgid "select privacy"
|
msgid "select privacy"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:77
|
#: lib/memex_web/live/invite_live/index.html.heex:79
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "set unlimited"
|
msgid "set unlimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:10
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:3
|
#: lib/memex_web/templates/user_settings/edit.html.heex:3
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "settings"
|
msgid "settings"
|
||||||
@ -321,17 +325,17 @@ msgstr ""
|
|||||||
msgid "tags"
|
msgid "tags"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:114
|
#: lib/memex_web/live/invite_live/index.html.heex:120
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "users"
|
msgid "users"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:118
|
#: lib/memex_web/live/home_live.html.heex:121
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "version:"
|
msgid "version:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:145
|
#: lib/memex_web/live/home_live.html.heex:148
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "view the source code"
|
msgid "view the source code"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -450,20 +454,24 @@ msgstr ""
|
|||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:23
|
#: lib/memex_web/components/topbar.ex:23
|
||||||
#: lib/memex_web/live/home_live.html.heex:3
|
#: lib/memex_web/live/home_live.html.heex:3
|
||||||
#: lib/memex_web/templates/error/error.html.heex:8
|
|
||||||
#: lib/memex_web/templates/layout/root.html.heex:8
|
#: lib/memex_web/templates/layout/root.html.heex:8
|
||||||
#: lib/memex_web/templates/layout/root.html.heex:9
|
#: lib/memex_web/templates/layout/root.html.heex:9
|
||||||
#: lib/memex_web/views/layout_view.ex:15
|
#: lib/memex_web/views/layout_view.ex:11
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "memEx"
|
msgid "memEx"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/home_live.html.heex:41
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "read more on how to use %{name}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/faq_live.html.heex:11
|
#: lib/memex_web/live/faq_live.html.heex:11
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "what is this?"
|
msgid "what is this?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:67
|
#: lib/memex_web/live/pipeline_live/show.html.heex:68
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{position}. %{title}"
|
msgid "%{position}. %{title}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -488,12 +496,12 @@ msgstr ""
|
|||||||
msgid "add step to %{slug}"
|
msgid "add step to %{slug}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:61
|
#: lib/memex_web/live/pipeline_live/show.html.heex:62
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "no steps"
|
msgid "no steps"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:56
|
#: lib/memex_web/live/pipeline_live/show.html.heex:57
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "steps:"
|
msgid "steps:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -598,7 +606,7 @@ msgstr ""
|
|||||||
msgid "zettelkasten"
|
msgid "zettelkasten"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/views/layout_view.ex:11
|
#: lib/memex_web/views/layout_view.ex:10
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "memEx | %{title}"
|
msgid "memEx | %{title}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -628,7 +636,7 @@ msgstr ""
|
|||||||
msgid "while memEx fully supports multiple users, each memEx instance should be treated as a single cohesive and collaborative document."
|
msgid "while memEx fully supports multiple users, each memEx instance should be treated as a single cohesive and collaborative document."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:28
|
#: lib/memex_web/templates/user_registration/new.html.heex:32
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "language"
|
msgid "language"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -643,22 +651,12 @@ msgstr ""
|
|||||||
msgid "user registered on%{registered_datetime}"
|
msgid "user registered on%{registered_datetime}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:37
|
#: lib/memex_web/components/invite_card.ex:22
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "uses left: %{uses_left}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/components/invite_card.ex:27
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "uses left: unlimited"
|
msgid "uses left: unlimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:41
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "read more on how to use memEx"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:32
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "uses left: %{uses_left_count}"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:52
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "uses: %{uses_count}"
|
|
||||||
msgstr ""
|
|
||||||
|
@ -10,6 +10,11 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Email change link is invalid or it has expired."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/error/error.html.heex:8
|
#: lib/memex_web/templates/error/error.html.heex:8
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
@ -20,8 +25,9 @@ msgstr ""
|
|||||||
msgid "Invalid email or password"
|
msgid "Invalid email or password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:14
|
#: lib/memex_web/templates/user_registration/new.html.heex:15
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:67
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:15
|
||||||
|
#: lib/memex_web/templates/user_settings/edit.html.heex:64
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Oops, something went wrong! Please check the errors below."
|
msgid "Oops, something went wrong! Please check the errors below."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -31,23 +37,33 @@ msgstr ""
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:22
|
#: lib/memex_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:51
|
#: lib/memex_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:12
|
#: lib/memex_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:41
|
#: lib/memex_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:99
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Unable to delete user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_confirmation_controller.ex:54
|
#: lib/memex_web/controllers/user_confirmation_controller.ex:54
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "User confirmation link is invalid or it has expired."
|
msgid "User confirmation link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:18
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "You are not authorized to view this page"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_auth.ex:177
|
#: lib/memex_web/controllers/user_auth.ex:177
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
@ -59,28 +75,28 @@ msgstr ""
|
|||||||
msgid "You must confirm your account and log in to access this page."
|
msgid "You must confirm your account and log in to access this page."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:144
|
#: lib/memex/accounts/user.ex:139
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:165
|
#: lib/memex/accounts/user.ex:160
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:202
|
#: lib/memex/accounts/user.ex:197
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:99
|
#: lib/memex/accounts/user.ex:95
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:23
|
#: lib/memex_web/templates/user_settings/edit.html.heex:21
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:123
|
#: lib/memex_web/templates/user_settings/edit.html.heex:119
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "oops, something went wrong! Please check the errors below"
|
msgid "oops, something went wrong! Please check the errors below"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -121,28 +137,3 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:13
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "oops, something went wrong! please check the errors below."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:70
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "sorry, this invite was not found or expired"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:19
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "you are not authorized to view this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "email change link is invalid or it has expired."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:99
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "unable to delete user"
|
|
||||||
msgstr ""
|
|
||||||
|
@ -15,31 +15,56 @@ msgstr ""
|
|||||||
msgid "%{email} confirmed successfully."
|
msgid "%{email} confirmed successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:54
|
#: lib/memex_web/live/invite_live/form_component.ex:62
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "%{invite_name} created successfully"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:53
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} deleted succesfully"
|
msgid "%{invite_name} deleted succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:115
|
#: lib/memex_web/live/invite_live/index.ex:114
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} disabled succesfully"
|
msgid "%{invite_name} disabled succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:91
|
#: lib/memex_web/live/invite_live/index.ex:90
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} enabled succesfully"
|
msgid "%{invite_name} enabled succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:69
|
#: lib/memex_web/live/invite_live/index.ex:68
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} updated succesfully"
|
msgid "%{invite_name} updated succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:140
|
#: lib/memex_web/live/invite_live/form_component.ex:42
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "%{invite_name} updated successfully"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:139
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{user_email} deleted succesfully"
|
msgid "%{user_email} deleted succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:29
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "A link to confirm your email change has been sent to the new address."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:127
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Copied to clipboard"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:77
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Email changed successfully."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_confirmation_controller.ex:23
|
#: lib/memex_web/controllers/user_confirmation_controller.ex:23
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
msgid "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||||
@ -55,53 +80,73 @@ msgstr ""
|
|||||||
msgid "Password reset successfully."
|
msgid "Password reset successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:31
|
#: lib/memex_web/controllers/user_settings_controller.ex:49
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Password updated successfully."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_registration_controller.ex:73
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Please check your email to verify your account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/form_component.html.heex:30
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Saving..."
|
msgid "Saving..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:136
|
#: lib/memex_web/controllers/user_settings_controller.ex:95
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Your account has been deleted"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/templates/user_settings/edit.html.heex:133
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to change your language?"
|
msgid "are you sure you want to change your language?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:97
|
#: lib/memex_web/live/invite_live/index.html.heex:102
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:125
|
#: lib/memex_web/live/invite_live/index.html.heex:132
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to delete %{email}? This action is permanent!"
|
msgid "are you sure you want to delete %{email}? This action is permanent!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:47
|
#: lib/memex_web/live/invite_live/index.html.heex:48
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to delete the invite for %{invite_name}?"
|
msgid "are you sure you want to delete the invite for %{invite_name}?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:155
|
#: lib/memex_web/templates/user_settings/edit.html.heex:152
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to delete your account?"
|
msgid "are you sure you want to delete your account?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:90
|
#: lib/memex_web/components/topbar.ex:92
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to log out?"
|
msgid "are you sure you want to log out?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:72
|
#: lib/memex_web/live/invite_live/index.html.heex:74
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to make %{invite_name} unlimited?"
|
msgid "are you sure you want to make %{invite_name} unlimited?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:45
|
#: lib/memex_web/live/context_live/index.html.heex:46
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:38
|
#: lib/memex_web/live/context_live/show.html.heex:37
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:45
|
#: lib/memex_web/live/note_live/index.html.heex:46
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:38
|
#: lib/memex_web/live/note_live/show.html.heex:34
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:45
|
#: lib/memex_web/live/pipeline_live/index.html.heex:46
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:46
|
#: lib/memex_web/live/pipeline_live/show.html.heex:46
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:115
|
#: lib/memex_web/live/pipeline_live/show.html.heex:116
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure?"
|
msgid "are you sure?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/home_live.html.heex:95
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "register to setup %{name}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_session_controller.ex:23
|
#: lib/memex_web/controllers/user_session_controller.ex:23
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "logged out successfully."
|
msgid "logged out successfully."
|
||||||
@ -111,48 +156,3 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "language updated successfully."
|
msgid "language updated successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:95
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "register to setup memEx"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.ex:80
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "%{name} created successfully"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.ex:62
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "%{name} updated successfully"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:128
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "copied to clipboard"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:65
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "please check your email to verify your account"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:29
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "a link to confirm your email change has been sent to the new address."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:77
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "email changed successfully."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:49
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "password updated successfully."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:95
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "your account has been deleted"
|
|
||||||
msgstr ""
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:86
|
#: lib/memex_web/live/invite_live/index.html.heex:90
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Admins"
|
msgid "Admins"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -20,17 +20,17 @@ msgstr ""
|
|||||||
msgid "Confirm your account"
|
msgid "Confirm your account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_session/new.html.heex:25
|
#: lib/memex_web/templates/user_session/new.html.heex:27
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Keep me logged in for 60 days"
|
msgid "Keep me logged in for 60 days"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:21
|
#: lib/memex_web/live/invite_live/form_component.html.heex:20
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/layout/live.html.heex:43
|
#: lib/memex_web/templates/layout/live.html.heex:40
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Reconnecting..."
|
msgid "Reconnecting..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -40,14 +40,19 @@ msgstr ""
|
|||||||
msgid "Reset your password"
|
msgid "Reset your password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:25
|
#: lib/memex_web/controllers/user_settings_controller.ex:10
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/form_component.html.heex:24
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Uses left"
|
msgid "Uses left"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:19
|
#: lib/memex_web/live/context_live/show.html.heex:17
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:19
|
#: lib/memex_web/live/note_live/show.html.heex:17
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:27
|
#: lib/memex_web/live/pipeline_live/show.html.heex:26
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Visibility: %{visibility}"
|
msgid "Visibility: %{visibility}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -67,7 +72,7 @@ msgstr ""
|
|||||||
msgid "built with sharing and collaboration in mind"
|
msgid "built with sharing and collaboration in mind"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:80
|
#: lib/memex_web/templates/user_settings/edit.html.heex:78
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "confirm new password"
|
msgid "confirm new password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -95,13 +100,13 @@ msgstr ""
|
|||||||
msgid "convenient:"
|
msgid "convenient:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:33
|
#: lib/memex_web/templates/user_settings/edit.html.heex:32
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:89
|
#: lib/memex_web/templates/user_settings/edit.html.heex:87
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "current password"
|
msgid "current password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:62
|
#: lib/memex_web/live/invite_live/index.html.heex:59
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "disable"
|
msgid "disable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -116,12 +121,12 @@ msgstr ""
|
|||||||
msgid "document your processes, attaching contexts to each step"
|
msgid "document your processes, attaching contexts to each step"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:34
|
#: lib/memex_web/live/invite_live/index.ex:33
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "edit invite"
|
msgid "edit invite"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:29
|
#: lib/memex_web/templates/user_settings/edit.html.heex:28
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "email"
|
msgid "email"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -131,13 +136,13 @@ msgstr ""
|
|||||||
msgid "email unconfirmed"
|
msgid "email unconfirmed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:62
|
#: lib/memex_web/live/invite_live/index.html.heex:63
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "enable"
|
msgid "enable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:32
|
#: lib/memex_web/templates/user_registration/new.html.heex:36
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:129
|
#: lib/memex_web/templates/user_settings/edit.html.heex:126
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "english"
|
msgid "english"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -147,12 +152,12 @@ msgstr ""
|
|||||||
msgid "features"
|
msgid "features"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:135
|
#: lib/memex_web/live/home_live.html.heex:138
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "get involved!"
|
msgid "get involved!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:156
|
#: lib/memex_web/live/home_live.html.heex:159
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "help translate"
|
msgid "help translate"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -162,18 +167,18 @@ msgstr ""
|
|||||||
msgid "instance information"
|
msgid "instance information"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:42
|
#: lib/memex_web/components/invite_card.ex:32
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invite disabled"
|
msgid "invite disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:112
|
#: lib/memex_web/live/home_live.html.heex:115
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invite only"
|
msgid "invite only"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:73
|
#: lib/memex_web/components/topbar.ex:74
|
||||||
#: lib/memex_web/live/invite_live/index.ex:42
|
#: lib/memex_web/live/invite_live/index.ex:41
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:3
|
#: lib/memex_web/live/invite_live/index.html.heex:3
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invites"
|
msgid "invites"
|
||||||
@ -189,12 +194,12 @@ msgstr ""
|
|||||||
msgid "multi-user:"
|
msgid "multi-user:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:38
|
#: lib/memex_web/live/invite_live/index.ex:37
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new invite"
|
msgid "new invite"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:73
|
#: lib/memex_web/templates/user_settings/edit.html.heex:71
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "new password"
|
msgid "new password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -250,22 +255,22 @@ msgstr ""
|
|||||||
msgid "provide context around a single topic and hotlink to your notes"
|
msgid "provide context around a single topic and hotlink to your notes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:111
|
#: lib/memex_web/live/home_live.html.heex:114
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "public signups"
|
msgid "public signups"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:32
|
#: lib/memex_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "register"
|
msgid "register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:108
|
#: lib/memex_web/live/home_live.html.heex:110
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "registration:"
|
msgid "registration:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:167
|
#: lib/memex_web/live/home_live.html.heex:170
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "report bugs or request features"
|
msgid "report bugs or request features"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -285,12 +290,11 @@ msgstr ""
|
|||||||
msgid "select privacy"
|
msgid "select privacy"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:77
|
#: lib/memex_web/live/invite_live/index.html.heex:79
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "set unlimited"
|
msgid "set unlimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:10
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:3
|
#: lib/memex_web/templates/user_settings/edit.html.heex:3
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "settings"
|
msgid "settings"
|
||||||
@ -310,17 +314,17 @@ msgstr ""
|
|||||||
msgid "tags"
|
msgid "tags"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:114
|
#: lib/memex_web/live/invite_live/index.html.heex:120
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "users"
|
msgid "users"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:118
|
#: lib/memex_web/live/home_live.html.heex:121
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "version:"
|
msgid "version:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:145
|
#: lib/memex_web/live/home_live.html.heex:148
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "view the source code"
|
msgid "view the source code"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -439,20 +443,24 @@ msgstr ""
|
|||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:23
|
#: lib/memex_web/components/topbar.ex:23
|
||||||
#: lib/memex_web/live/home_live.html.heex:3
|
#: lib/memex_web/live/home_live.html.heex:3
|
||||||
#: lib/memex_web/templates/error/error.html.heex:8
|
|
||||||
#: lib/memex_web/templates/layout/root.html.heex:8
|
#: lib/memex_web/templates/layout/root.html.heex:8
|
||||||
#: lib/memex_web/templates/layout/root.html.heex:9
|
#: lib/memex_web/templates/layout/root.html.heex:9
|
||||||
#: lib/memex_web/views/layout_view.ex:15
|
#: lib/memex_web/views/layout_view.ex:11
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "memEx"
|
msgid "memEx"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/home_live.html.heex:41
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "read more on how to use %{name}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/faq_live.html.heex:11
|
#: lib/memex_web/live/faq_live.html.heex:11
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "what is this?"
|
msgid "what is this?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:67
|
#: lib/memex_web/live/pipeline_live/show.html.heex:68
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{position}. %{title}"
|
msgid "%{position}. %{title}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -477,12 +485,12 @@ msgstr ""
|
|||||||
msgid "add step to %{slug}"
|
msgid "add step to %{slug}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:61
|
#: lib/memex_web/live/pipeline_live/show.html.heex:62
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "no steps"
|
msgid "no steps"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:56
|
#: lib/memex_web/live/pipeline_live/show.html.heex:57
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "steps:"
|
msgid "steps:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -587,7 +595,7 @@ msgstr ""
|
|||||||
msgid "zettelkasten"
|
msgid "zettelkasten"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/views/layout_view.ex:11
|
#: lib/memex_web/views/layout_view.ex:10
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "memEx | %{title}"
|
msgid "memEx | %{title}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -617,7 +625,7 @@ msgstr ""
|
|||||||
msgid "while memEx fully supports multiple users, each memEx instance should be treated as a single cohesive and collaborative document."
|
msgid "while memEx fully supports multiple users, each memEx instance should be treated as a single cohesive and collaborative document."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:28
|
#: lib/memex_web/templates/user_registration/new.html.heex:32
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "language"
|
msgid "language"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -632,22 +640,12 @@ msgstr ""
|
|||||||
msgid "user registered on%{registered_datetime}"
|
msgid "user registered on%{registered_datetime}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:37
|
#: lib/memex_web/components/invite_card.ex:22
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "uses left: %{uses_left}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/components/invite_card.ex:27
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "uses left: unlimited"
|
msgid "uses left: unlimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:41
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "read more on how to use memEx"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:32
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "uses left: %{uses_left_count}"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/components/invite_card.ex:52
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "uses: %{uses_count}"
|
|
||||||
msgstr ""
|
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Email change link is invalid or it has expired."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/error/error.html.heex:8
|
#: lib/memex_web/templates/error/error.html.heex:8
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
@ -20,8 +25,9 @@ msgstr ""
|
|||||||
msgid "Invalid email or password"
|
msgid "Invalid email or password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_reset_password/edit.html.heex:14
|
#: lib/memex_web/templates/user_registration/new.html.heex:15
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:67
|
#: lib/memex_web/templates/user_reset_password/edit.html.heex:15
|
||||||
|
#: lib/memex_web/templates/user_settings/edit.html.heex:64
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Oops, something went wrong! Please check the errors below."
|
msgid "Oops, something went wrong! Please check the errors below."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -31,23 +37,33 @@ msgstr ""
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:22
|
#: lib/memex_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:51
|
#: lib/memex_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:12
|
#: lib/memex_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:41
|
#: lib/memex_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:99
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Unable to delete user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_confirmation_controller.ex:54
|
#: lib/memex_web/controllers/user_confirmation_controller.ex:54
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "User confirmation link is invalid or it has expired."
|
msgid "User confirmation link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:18
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "You are not authorized to view this page"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_auth.ex:177
|
#: lib/memex_web/controllers/user_auth.ex:177
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
@ -59,28 +75,28 @@ msgstr ""
|
|||||||
msgid "You must confirm your account and log in to access this page."
|
msgid "You must confirm your account and log in to access this page."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:144
|
#: lib/memex/accounts/user.ex:139
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:165
|
#: lib/memex/accounts/user.ex:160
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:202
|
#: lib/memex/accounts/user.ex:197
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/accounts/user.ex:99
|
#: lib/memex/accounts/user.ex:95
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:23
|
#: lib/memex_web/templates/user_settings/edit.html.heex:21
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:123
|
#: lib/memex_web/templates/user_settings/edit.html.heex:119
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "oops, something went wrong! Please check the errors below"
|
msgid "oops, something went wrong! Please check the errors below"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -121,28 +137,3 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_registration/new.html.heex:13
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "oops, something went wrong! please check the errors below."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:70
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "sorry, this invite was not found or expired"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:19
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "you are not authorized to view this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "email change link is invalid or it has expired."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:99
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "unable to delete user"
|
|
||||||
msgstr ""
|
|
||||||
|
@ -15,31 +15,56 @@ msgstr ""
|
|||||||
msgid "%{email} confirmed successfully."
|
msgid "%{email} confirmed successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:54
|
#: lib/memex_web/live/invite_live/form_component.ex:62
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "%{invite_name} created successfully"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:53
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} deleted succesfully"
|
msgid "%{invite_name} deleted succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:115
|
#: lib/memex_web/live/invite_live/index.ex:114
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} disabled succesfully"
|
msgid "%{invite_name} disabled succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:91
|
#: lib/memex_web/live/invite_live/index.ex:90
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} enabled succesfully"
|
msgid "%{invite_name} enabled succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:69
|
#: lib/memex_web/live/invite_live/index.ex:68
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{invite_name} updated succesfully"
|
msgid "%{invite_name} updated succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:140
|
#: lib/memex_web/live/invite_live/form_component.ex:42
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "%{invite_name} updated successfully"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:139
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "%{user_email} deleted succesfully"
|
msgid "%{user_email} deleted succesfully"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:29
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "A link to confirm your email change has been sent to the new address."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/index.ex:127
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Copied to clipboard"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_settings_controller.ex:77
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Email changed successfully."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_confirmation_controller.ex:23
|
#: lib/memex_web/controllers/user_confirmation_controller.ex:23
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
msgid "If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||||
@ -55,53 +80,73 @@ msgstr ""
|
|||||||
msgid "Password reset successfully."
|
msgid "Password reset successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.html.heex:31
|
#: lib/memex_web/controllers/user_settings_controller.ex:49
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Password updated successfully."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/controllers/user_registration_controller.ex:73
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Please check your email to verify your account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/invite_live/form_component.html.heex:30
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Saving..."
|
msgid "Saving..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:136
|
#: lib/memex_web/controllers/user_settings_controller.ex:95
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Your account has been deleted"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/templates/user_settings/edit.html.heex:133
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to change your language?"
|
msgid "are you sure you want to change your language?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:97
|
#: lib/memex_web/live/invite_live/index.html.heex:102
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:125
|
#: lib/memex_web/live/invite_live/index.html.heex:132
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to delete %{email}? This action is permanent!"
|
msgid "are you sure you want to delete %{email}? This action is permanent!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:47
|
#: lib/memex_web/live/invite_live/index.html.heex:48
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to delete the invite for %{invite_name}?"
|
msgid "are you sure you want to delete the invite for %{invite_name}?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/templates/user_settings/edit.html.heex:155
|
#: lib/memex_web/templates/user_settings/edit.html.heex:152
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to delete your account?"
|
msgid "are you sure you want to delete your account?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/components/topbar.ex:90
|
#: lib/memex_web/components/topbar.ex:92
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to log out?"
|
msgid "are you sure you want to log out?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.html.heex:72
|
#: lib/memex_web/live/invite_live/index.html.heex:74
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure you want to make %{invite_name} unlimited?"
|
msgid "are you sure you want to make %{invite_name} unlimited?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/context_live/index.html.heex:45
|
#: lib/memex_web/live/context_live/index.html.heex:46
|
||||||
#: lib/memex_web/live/context_live/show.html.heex:38
|
#: lib/memex_web/live/context_live/show.html.heex:37
|
||||||
#: lib/memex_web/live/note_live/index.html.heex:45
|
#: lib/memex_web/live/note_live/index.html.heex:46
|
||||||
#: lib/memex_web/live/note_live/show.html.heex:38
|
#: lib/memex_web/live/note_live/show.html.heex:34
|
||||||
#: lib/memex_web/live/pipeline_live/index.html.heex:45
|
#: lib/memex_web/live/pipeline_live/index.html.heex:46
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:46
|
#: lib/memex_web/live/pipeline_live/show.html.heex:46
|
||||||
#: lib/memex_web/live/pipeline_live/show.html.heex:115
|
#: lib/memex_web/live/pipeline_live/show.html.heex:116
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "are you sure?"
|
msgid "are you sure?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex_web/live/home_live.html.heex:95
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "register to setup %{name}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_session_controller.ex:23
|
#: lib/memex_web/controllers/user_session_controller.ex:23
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "logged out successfully."
|
msgid "logged out successfully."
|
||||||
@ -111,48 +156,3 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "language updated successfully."
|
msgid "language updated successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex_web/live/home_live.html.heex:95
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "register to setup memEx"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.ex:80
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "%{name} created successfully"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/form_component.ex:62
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "%{name} updated successfully"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/live/invite_live/index.ex:128
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "copied to clipboard"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_controller.ex:65
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "please check your email to verify your account"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:29
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "a link to confirm your email change has been sent to the new address."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:77
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "email changed successfully."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:49
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "password updated successfully."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_settings_controller.ex:95
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "your account has been deleted"
|
|
||||||
msgstr ""
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
defmodule Memex.Repo.Migrations.RecordInvites do
|
|
||||||
use Ecto.Migration
|
|
||||||
|
|
||||||
def change do
|
|
||||||
alter table(:users) do
|
|
||||||
add :invite_id, references(:invites, type: :binary_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
rename table(:invites), :user_id, to: :created_by_id
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,176 +0,0 @@
|
|||||||
defmodule Memex.InvitesTest do
|
|
||||||
@moduledoc """
|
|
||||||
This module tests the Memex.Accounts.Invites context
|
|
||||||
"""
|
|
||||||
|
|
||||||
use Memex.DataCase
|
|
||||||
alias Ecto.Changeset
|
|
||||||
alias Memex.Accounts
|
|
||||||
alias Memex.Accounts.{Invite, Invites}
|
|
||||||
|
|
||||||
@moduletag :invites_test
|
|
||||||
|
|
||||||
@valid_attrs %{
|
|
||||||
"name" => "some name"
|
|
||||||
}
|
|
||||||
@invalid_attrs %{
|
|
||||||
"name" => nil,
|
|
||||||
"token" => nil
|
|
||||||
}
|
|
||||||
|
|
||||||
describe "invites" do
|
|
||||||
setup do
|
|
||||||
current_user = admin_fixture()
|
|
||||||
{:ok, invite} = Invites.create_invite(current_user, @valid_attrs)
|
|
||||||
[invite: invite, current_user: current_user]
|
|
||||||
end
|
|
||||||
|
|
||||||
test "list_invites/0 returns all invites", %{invite: invite, current_user: current_user} do
|
|
||||||
assert Invites.list_invites(current_user) == [invite]
|
|
||||||
end
|
|
||||||
|
|
||||||
test "get_invite!/1 returns the invite with given id",
|
|
||||||
%{invite: invite, current_user: current_user} do
|
|
||||||
assert Invites.get_invite!(invite.id, current_user) == invite
|
|
||||||
end
|
|
||||||
|
|
||||||
test "valid_invite_token? returns for valid and invalid invite tokens",
|
|
||||||
%{invite: %{token: token}} do
|
|
||||||
refute Invites.valid_invite_token?(nil)
|
|
||||||
refute Invites.valid_invite_token?("")
|
|
||||||
assert Invites.valid_invite_token?(token)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "valid_invite_token? does not return true for a disabled invite by token",
|
|
||||||
%{invite: %{token: token} = invite, current_user: current_user} do
|
|
||||||
assert Invites.valid_invite_token?(token)
|
|
||||||
|
|
||||||
{:ok, _invite} = Invites.update_invite(invite, %{uses_left: 1}, current_user)
|
|
||||||
{:ok, _invite} = Invites.use_invite(token)
|
|
||||||
|
|
||||||
refute Invites.valid_invite_token?(token)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "get_use_count/2 returns the correct invite usage",
|
|
||||||
%{invite: %{token: token} = invite, current_user: current_user} do
|
|
||||||
assert 0 == Invites.get_use_count(invite, current_user)
|
|
||||||
|
|
||||||
assert {:ok, _user} =
|
|
||||||
Accounts.register_user(
|
|
||||||
%{"email" => unique_user_email(), "password" => valid_user_password()},
|
|
||||||
token
|
|
||||||
)
|
|
||||||
|
|
||||||
assert 1 == Invites.get_use_count(invite, current_user)
|
|
||||||
|
|
||||||
assert {:ok, _user} =
|
|
||||||
Accounts.register_user(
|
|
||||||
%{"email" => unique_user_email(), "password" => valid_user_password()},
|
|
||||||
token
|
|
||||||
)
|
|
||||||
|
|
||||||
assert 2 == Invites.get_use_count(invite, current_user)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "use_invite/1 successfully uses an unlimited invite",
|
|
||||||
%{invite: %{token: token} = invite, current_user: current_user} do
|
|
||||||
{:ok, invite} = Invites.update_invite(invite, %{uses_left: nil}, current_user)
|
|
||||||
assert {:ok, ^invite} = Invites.use_invite(token)
|
|
||||||
assert {:ok, ^invite} = Invites.use_invite(token)
|
|
||||||
assert {:ok, ^invite} = Invites.use_invite(token)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "use_invite/1 successfully decrements an invite",
|
|
||||||
%{invite: %{token: token} = invite, current_user: current_user} do
|
|
||||||
{:ok, _invite} = Invites.update_invite(invite, %{uses_left: 10}, current_user)
|
|
||||||
assert {:ok, %{uses_left: 9}} = Invites.use_invite(token)
|
|
||||||
assert {:ok, %{uses_left: 8}} = Invites.use_invite(token)
|
|
||||||
assert {:ok, %{uses_left: 7}} = Invites.use_invite(token)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "use_invite/1 successfully disactivates an invite",
|
|
||||||
%{invite: %{token: token} = invite, current_user: current_user} do
|
|
||||||
{:ok, _invite} = Invites.update_invite(invite, %{uses_left: 1}, current_user)
|
|
||||||
assert {:ok, %{uses_left: 0, disabled_at: disabled_at}} = Invites.use_invite(token)
|
|
||||||
assert not is_nil(disabled_at)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "use_invite/1 does not work on disactivated invite",
|
|
||||||
%{invite: %{token: token} = invite, current_user: current_user} do
|
|
||||||
{:ok, _invite} = Invites.update_invite(invite, %{uses_left: 1}, current_user)
|
|
||||||
{:ok, _invite} = Invites.use_invite(token)
|
|
||||||
assert {:error, :invalid_token} = Invites.use_invite(token)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "create_invite/1 with valid data creates an unlimited invite",
|
|
||||||
%{current_user: current_user} do
|
|
||||||
assert {:ok, %Invite{} = invite} =
|
|
||||||
Invites.create_invite(current_user, %{
|
|
||||||
"name" => "some name"
|
|
||||||
})
|
|
||||||
|
|
||||||
assert invite.name == "some name"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "create_invite/1 with valid data creates a limited invite",
|
|
||||||
%{current_user: current_user} do
|
|
||||||
assert {:ok, %Invite{} = invite} =
|
|
||||||
Invites.create_invite(current_user, %{
|
|
||||||
"name" => "some name",
|
|
||||||
"uses_left" => 10
|
|
||||||
})
|
|
||||||
|
|
||||||
assert invite.name == "some name"
|
|
||||||
assert invite.uses_left == 10
|
|
||||||
end
|
|
||||||
|
|
||||||
test "create_invite/1 with invalid data returns error changeset",
|
|
||||||
%{current_user: current_user} do
|
|
||||||
assert {:error, %Changeset{}} = Invites.create_invite(current_user, @invalid_attrs)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "update_invite/2 can set an invite to be limited",
|
|
||||||
%{invite: invite, current_user: current_user} do
|
|
||||||
assert {:ok, %Invite{} = new_invite} =
|
|
||||||
Invites.update_invite(
|
|
||||||
invite,
|
|
||||||
%{"name" => "some updated name", "uses_left" => 5},
|
|
||||||
current_user
|
|
||||||
)
|
|
||||||
|
|
||||||
assert new_invite.name == "some updated name"
|
|
||||||
assert new_invite.uses_left == 5
|
|
||||||
end
|
|
||||||
|
|
||||||
test "update_invite/2 can set an invite to be unlimited",
|
|
||||||
%{invite: invite, current_user: current_user} do
|
|
||||||
{:ok, invite} = Invites.update_invite(invite, %{"uses_left" => 5}, current_user)
|
|
||||||
|
|
||||||
assert {:ok, %Invite{} = new_invite} =
|
|
||||||
Invites.update_invite(
|
|
||||||
invite,
|
|
||||||
%{"name" => "some updated name", "uses_left" => nil},
|
|
||||||
current_user
|
|
||||||
)
|
|
||||||
|
|
||||||
assert new_invite.name == "some updated name"
|
|
||||||
assert new_invite.uses_left |> is_nil()
|
|
||||||
end
|
|
||||||
|
|
||||||
test "update_invite/2 with invalid data returns error changeset",
|
|
||||||
%{invite: invite, current_user: current_user} do
|
|
||||||
assert {:error, %Changeset{}} = Invites.update_invite(invite, @invalid_attrs, current_user)
|
|
||||||
assert invite == Invites.get_invite!(invite.id, current_user)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "delete_invite/1 deletes the invite", %{invite: invite, current_user: current_user} do
|
|
||||||
assert {:ok, %Invite{}} = Invites.delete_invite(invite, current_user)
|
|
||||||
assert_raise Ecto.NoResultsError, fn -> Invites.get_invite!(invite.id, current_user) end
|
|
||||||
end
|
|
||||||
|
|
||||||
test "delete_invite!/1 deletes the invite", %{invite: invite, current_user: current_user} do
|
|
||||||
assert %Invite{} = Invites.delete_invite!(invite, current_user)
|
|
||||||
assert_raise Ecto.NoResultsError, fn -> Invites.get_invite!(invite.id, current_user) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -6,12 +6,10 @@ defmodule Memex.AccountsTest do
|
|||||||
use Memex.DataCase
|
use Memex.DataCase
|
||||||
alias Ecto.Changeset
|
alias Ecto.Changeset
|
||||||
alias Memex.Accounts
|
alias Memex.Accounts
|
||||||
alias Memex.Accounts.{Invites, User, UserToken}
|
alias Memex.Accounts.{User, UserToken}
|
||||||
|
|
||||||
@moduletag :accounts_test
|
@moduletag :accounts_test
|
||||||
|
|
||||||
doctest Accounts, import: true
|
|
||||||
|
|
||||||
describe "get_user_by_email/1" do
|
describe "get_user_by_email/1" do
|
||||||
test "does not return the user if the email does not exist" do
|
test "does not return the user if the email does not exist" do
|
||||||
refute Accounts.get_user_by_email("unknown@example.com")
|
refute Accounts.get_user_by_email("unknown@example.com")
|
||||||
@ -102,17 +100,6 @@ defmodule Memex.AccountsTest do
|
|||||||
assert is_nil(user.confirmed_at)
|
assert is_nil(user.confirmed_at)
|
||||||
assert is_nil(user.password)
|
assert is_nil(user.password)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "records used invite during registration" do
|
|
||||||
{:ok, %{id: invite_id, token: token}} =
|
|
||||||
admin_fixture() |> Invites.create_invite(%{"name" => "my invite"})
|
|
||||||
|
|
||||||
assert {:ok, %{invite_id: ^invite_id}} =
|
|
||||||
Accounts.register_user(
|
|
||||||
%{"email" => unique_user_email(), "password" => valid_user_password()},
|
|
||||||
token
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "change_user_registration/2" do
|
describe "change_user_registration/2" do
|
||||||
@ -316,7 +303,7 @@ defmodule Memex.AccountsTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "deletes all tokens for the given user", %{user: user} do
|
test "deletes all tokens for the given user", %{user: user} do
|
||||||
_session_token = Accounts.generate_user_session_token(user)
|
_ = Accounts.generate_user_session_token(user)
|
||||||
|
|
||||||
{:ok, _} =
|
{:ok, _} =
|
||||||
Accounts.update_user_password(user, valid_user_password(), %{
|
Accounts.update_user_password(user, valid_user_password(), %{
|
||||||
@ -513,7 +500,7 @@ defmodule Memex.AccountsTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "deletes all tokens for the given user", %{user: user} do
|
test "deletes all tokens for the given user", %{user: user} do
|
||||||
_session_token = Accounts.generate_user_session_token(user)
|
_ = Accounts.generate_user_session_token(user)
|
||||||
{:ok, _} = Accounts.reset_user_password(user, %{"password" => "new valid password"})
|
{:ok, _} = Accounts.reset_user_password(user, %{"password" => "new valid password"})
|
||||||
refute Repo.get_by(UserToken, user_id: user.id)
|
refute Repo.get_by(UserToken, user_id: user.id)
|
||||||
end
|
end
|
||||||
|
76
test/memex/invites_text.exs
Normal file
76
test/memex/invites_text.exs
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
defmodule Memex.InvitesTest do
|
||||||
|
@moduledoc """
|
||||||
|
This module tests the Invites context
|
||||||
|
"""
|
||||||
|
|
||||||
|
use Memex.DataCase
|
||||||
|
alias Ecto.Changeset
|
||||||
|
alias Memex.{Invites, Invites.Invite}
|
||||||
|
|
||||||
|
@moduletag :invites_test
|
||||||
|
|
||||||
|
@valid_attrs %{
|
||||||
|
"name" => "some name",
|
||||||
|
"token" => "some token"
|
||||||
|
}
|
||||||
|
@update_attrs %{
|
||||||
|
"name" => "some updated name",
|
||||||
|
"token" => "some updated token"
|
||||||
|
}
|
||||||
|
@invalid_attrs %{
|
||||||
|
"name" => nil,
|
||||||
|
"token" => nil
|
||||||
|
}
|
||||||
|
|
||||||
|
describe "invites" do
|
||||||
|
setup do
|
||||||
|
current_user = admin_fixture()
|
||||||
|
{:ok, invite} = Invites.create_invite(current_user, @valid_attrs)
|
||||||
|
[invite: invite, current_user: current_user]
|
||||||
|
end
|
||||||
|
|
||||||
|
test "list_invites/0 returns all invites", %{invite: invite, current_user: current_user} do
|
||||||
|
assert Invites.list_invites(current_user) == [invite]
|
||||||
|
end
|
||||||
|
|
||||||
|
test "get_invite!/1 returns the invite with given id",
|
||||||
|
%{invite: invite, current_user: current_user} do
|
||||||
|
assert Invites.get_invite!(invite.id, current_user) == invite
|
||||||
|
end
|
||||||
|
|
||||||
|
test "create_invite/1 with valid data creates a invite",
|
||||||
|
%{current_user: current_user} do
|
||||||
|
assert {:ok, %Invite{} = invite} = Invites.create_invite(current_user, @valid_attrs)
|
||||||
|
assert invite.name == "some name"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "create_invite/1 with invalid data returns error changeset",
|
||||||
|
%{current_user: current_user} do
|
||||||
|
assert {:error, %Changeset{}} = Invites.create_invite(current_user, @invalid_attrs)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "update_invite/2 with valid data updates the invite",
|
||||||
|
%{invite: invite, current_user: current_user} do
|
||||||
|
assert {:ok, %Invite{} = new_invite} =
|
||||||
|
Invites.update_invite(invite, @update_attrs, current_user)
|
||||||
|
|
||||||
|
assert new_invite.name == "some updated name"
|
||||||
|
assert new_invite.token == new_invite.token
|
||||||
|
end
|
||||||
|
|
||||||
|
test "update_invite/2 with invalid data returns error changeset",
|
||||||
|
%{invite: invite, current_user: current_user} do
|
||||||
|
assert {:error, %Changeset{}} = Invites.update_invite(invite, @invalid_attrs, current_user)
|
||||||
|
assert invite == Invites.get_invite!(invite.id, current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "delete_invite/1 deletes the invite", %{invite: invite, current_user: current_user} do
|
||||||
|
assert {:ok, %Invite{}} = Invites.delete_invite(invite, current_user)
|
||||||
|
assert_raise Ecto.NoResultsError, fn -> Invites.get_invite!(invite.id, current_user) end
|
||||||
|
end
|
||||||
|
|
||||||
|
test "change_invite/1 returns a invite changeset", %{invite: invite} do
|
||||||
|
assert %Changeset{} = Invites.change_invite(invite)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -8,7 +8,14 @@ defmodule MemexWeb.ExportControllerTest do
|
|||||||
|
|
||||||
@moduletag :export_controller_test
|
@moduletag :export_controller_test
|
||||||
|
|
||||||
setup [:register_and_log_in_user]
|
setup %{conn: conn} do
|
||||||
|
current_user = user_fixture() |> confirm_user()
|
||||||
|
|
||||||
|
[
|
||||||
|
current_user: current_user,
|
||||||
|
conn: conn |> log_in_user(current_user)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
defp add_data(%{current_user: current_user}) do
|
defp add_data(%{current_user: current_user}) do
|
||||||
note = note_fixture(current_user)
|
note = note_fixture(current_user)
|
||||||
|
@ -116,7 +116,7 @@ defmodule MemexWeb.UserAuthTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "does not authenticate if data is missing", %{conn: conn, current_user: current_user} do
|
test "does not authenticate if data is missing", %{conn: conn, current_user: current_user} do
|
||||||
_session_token = Accounts.generate_user_session_token(current_user)
|
_ = Accounts.generate_user_session_token(current_user)
|
||||||
conn = UserAuth.fetch_current_user(conn, [])
|
conn = UserAuth.fetch_current_user(conn, [])
|
||||||
refute get_session(conn, :user_token)
|
refute get_session(conn, :user_token)
|
||||||
refute conn.assigns.current_user
|
refute conn.assigns.current_user
|
||||||
|
@ -5,7 +5,8 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
|||||||
|
|
||||||
use MemexWeb.ConnCase, async: true
|
use MemexWeb.ConnCase, async: true
|
||||||
import MemexWeb.Gettext
|
import MemexWeb.Gettext
|
||||||
alias Memex.{Accounts, Repo}
|
alias Memex.Accounts
|
||||||
|
alias Memex.Repo
|
||||||
|
|
||||||
@moduletag :user_confirmation_controller_test
|
@moduletag :user_confirmation_controller_test
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
|||||||
})
|
})
|
||||||
|
|
||||||
assert get_session(conn, :phoenix_flash) == %{
|
assert get_session(conn, :phoenix_flash) == %{
|
||||||
"info" => dgettext("prompts", "please check your email to verify your account")
|
"info" => dgettext("prompts", "Please check your email to verify your account")
|
||||||
}
|
}
|
||||||
|
|
||||||
assert redirected_to(conn) =~ "/"
|
assert redirected_to(conn) =~ "/"
|
||||||
|
@ -15,7 +15,7 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
test "renders settings page", %{conn: conn} do
|
test "renders settings page", %{conn: conn} do
|
||||||
conn = get(conn, Routes.user_settings_path(conn, :edit))
|
conn = get(conn, Routes.user_settings_path(conn, :edit))
|
||||||
response = html_response(conn, 200)
|
response = html_response(conn, 200)
|
||||||
assert response =~ gettext("settings")
|
assert response =~ gettext("Settings")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "redirects if user is not logged in" do
|
test "redirects if user is not logged in" do
|
||||||
@ -27,7 +27,7 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
|
|
||||||
describe "PUT /users/settings (change password form)" do
|
describe "PUT /users/settings (change password form)" do
|
||||||
test "updates the user password and resets tokens",
|
test "updates the user password and resets tokens",
|
||||||
%{conn: conn, current_user: current_user} do
|
%{conn: conn, user: user} do
|
||||||
new_password_conn =
|
new_password_conn =
|
||||||
put(conn, Routes.user_settings_path(conn, :update), %{
|
put(conn, Routes.user_settings_path(conn, :update), %{
|
||||||
"action" => "update_password",
|
"action" => "update_password",
|
||||||
@ -42,9 +42,9 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token)
|
assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token)
|
||||||
|
|
||||||
assert get_flash(new_password_conn, :info) =~
|
assert get_flash(new_password_conn, :info) =~
|
||||||
dgettext("actions", "password updated successfully")
|
dgettext("actions", "Password updated successfully")
|
||||||
|
|
||||||
assert Accounts.get_user_by_email_and_password(current_user.email, "new valid password")
|
assert Accounts.get_user_by_email_and_password(user.email, "new valid password")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not update password on invalid data", %{conn: conn} do
|
test "does not update password on invalid data", %{conn: conn} do
|
||||||
@ -70,7 +70,7 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
|
|
||||||
describe "PUT /users/settings (change email form)" do
|
describe "PUT /users/settings (change email form)" do
|
||||||
@tag :capture_log
|
@tag :capture_log
|
||||||
test "updates the user email", %{conn: conn, current_user: current_user} do
|
test "updates the user email", %{conn: conn, user: user} do
|
||||||
conn =
|
conn =
|
||||||
put(conn, Routes.user_settings_path(conn, :update), %{
|
put(conn, Routes.user_settings_path(conn, :update), %{
|
||||||
"action" => "update_email",
|
"action" => "update_email",
|
||||||
@ -83,10 +83,10 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
assert get_flash(conn, :info) =~
|
assert get_flash(conn, :info) =~
|
||||||
dgettext(
|
dgettext(
|
||||||
"prompts",
|
"prompts",
|
||||||
"a link to confirm your email change has been sent to the new address."
|
"A link to confirm your email change has been sent to the new address."
|
||||||
)
|
)
|
||||||
|
|
||||||
assert Accounts.get_user_by_email(current_user.email)
|
assert Accounts.get_user_by_email(user.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not update email on invalid data", %{conn: conn} do
|
test "does not update email on invalid data", %{conn: conn} do
|
||||||
@ -105,14 +105,14 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /users/settings/confirm_email/:token" do
|
describe "GET /users/settings/confirm_email/:token" do
|
||||||
setup %{current_user: current_user} do
|
setup %{user: user} do
|
||||||
email = unique_user_email()
|
email = unique_user_email()
|
||||||
|
|
||||||
token =
|
token =
|
||||||
extract_user_token(fn url ->
|
extract_user_token(fn url ->
|
||||||
Accounts.deliver_update_email_instructions(
|
Accounts.deliver_update_email_instructions(
|
||||||
%{current_user | email: email},
|
%{user | email: email},
|
||||||
current_user.email,
|
user.email,
|
||||||
url
|
url
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
@ -121,28 +121,28 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "updates the user email once",
|
test "updates the user email once",
|
||||||
%{conn: conn, current_user: current_user, token: token, email: email} do
|
%{conn: conn, user: user, token: token, email: email} do
|
||||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
||||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||||
assert get_flash(conn, :info) =~ dgettext("prompts", "email changed successfully")
|
assert get_flash(conn, :info) =~ dgettext("prompts", "Email changed successfully")
|
||||||
refute Accounts.get_user_by_email(current_user.email)
|
refute Accounts.get_user_by_email(user.email)
|
||||||
assert Accounts.get_user_by_email(email)
|
assert Accounts.get_user_by_email(email)
|
||||||
|
|
||||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
||||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||||
|
|
||||||
assert get_flash(conn, :error) =~
|
assert get_flash(conn, :error) =~
|
||||||
dgettext("errors", "email change link is invalid or it has expired")
|
dgettext("errors", "Email change link is invalid or it has expired")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not update email with invalid token", %{conn: conn, current_user: current_user} do
|
test "does not update email with invalid token", %{conn: conn, user: user} do
|
||||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, "oops"))
|
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, "oops"))
|
||||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||||
|
|
||||||
assert get_flash(conn, :error) =~
|
assert get_flash(conn, :error) =~
|
||||||
dgettext("errors", "email change link is invalid or it has expired")
|
dgettext("errors", "Email change link is invalid or it has expired")
|
||||||
|
|
||||||
assert Accounts.get_user_by_email(current_user.email)
|
assert Accounts.get_user_by_email(user.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "redirects if user is not logged in", %{token: token} do
|
test "redirects if user is not logged in", %{token: token} do
|
||||||
|
@ -23,8 +23,8 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
"visibility" => nil
|
"visibility" => nil
|
||||||
}
|
}
|
||||||
|
|
||||||
defp create_context(%{current_user: current_user}) do
|
defp create_context(%{user: user}) do
|
||||||
[context: context_fixture(current_user)]
|
[context: context_fixture(user)]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Index" do
|
describe "Index" do
|
||||||
@ -57,7 +57,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
|> form("#context-form", context: @invalid_attrs)
|
|> form("#context-form", context: @invalid_attrs)
|
||||||
|> render_change() =~ "can't be blank"
|
|> render_change() =~ "can't be blank"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#context-form", context: @create_attrs)
|
|> form("#context-form", context: @create_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -79,7 +79,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
|> form("#context-form", context: @invalid_attrs)
|
|> form("#context-form", context: @invalid_attrs)
|
||||||
|> render_change() =~ "can't be blank"
|
|> render_change() =~ "can't be blank"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#context-form", context: @update_attrs)
|
|> form("#context-form", context: @update_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -122,7 +122,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
assert html =~ "can't be blank"
|
assert html =~ "can't be blank"
|
||||||
assert html =~ "tags must be comma-delimited"
|
assert html =~ "tags must be comma-delimited"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
show_live
|
show_live
|
||||||
|> form("#context-form", context: Map.put(@update_attrs, "slug", context.slug))
|
|> form("#context-form", context: Map.put(@update_attrs, "slug", context.slug))
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -148,16 +148,13 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
describe "show with note" do
|
describe "show with note" do
|
||||||
setup [:register_and_log_in_user]
|
setup [:register_and_log_in_user]
|
||||||
|
|
||||||
setup %{current_user: current_user} do
|
setup %{user: user} do
|
||||||
%{slug: note_slug} = note = note_fixture(current_user)
|
%{slug: note_slug} = note = note_fixture(user)
|
||||||
|
|
||||||
[
|
[
|
||||||
note: note,
|
note: note,
|
||||||
context:
|
context:
|
||||||
context_fixture(
|
context_fixture(%{content: "example with backlink to [[#{note_slug}]] note"}, user)
|
||||||
%{content: "example with backlink to [[#{note_slug}]] note"},
|
|
||||||
current_user
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ defmodule MemexWeb.InviteLiveTest do
|
|||||||
use MemexWeb.ConnCase
|
use MemexWeb.ConnCase
|
||||||
import Phoenix.LiveViewTest
|
import Phoenix.LiveViewTest
|
||||||
import MemexWeb.Gettext
|
import MemexWeb.Gettext
|
||||||
alias Memex.Accounts.Invites
|
alias Memex.Invites
|
||||||
|
|
||||||
@moduletag :invite_live_test
|
@moduletag :invite_live_test
|
||||||
@create_attrs %{"name" => "some name"}
|
@create_attrs %{"name" => "some name"}
|
||||||
@ -16,9 +16,9 @@ defmodule MemexWeb.InviteLiveTest do
|
|||||||
describe "Index" do
|
describe "Index" do
|
||||||
setup [:register_and_log_in_user]
|
setup [:register_and_log_in_user]
|
||||||
|
|
||||||
setup %{current_user: current_user} do
|
setup %{user: user} do
|
||||||
{:ok, invite} = Invites.create_invite(current_user, @create_attrs)
|
{:ok, invite} = Invites.create_invite(user, @create_attrs)
|
||||||
%{invite: invite, current_user: current_user}
|
%{invite: invite, user: user}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "lists all invites", %{conn: conn, invite: invite} do
|
test "lists all invites", %{conn: conn, invite: invite} do
|
||||||
@ -40,7 +40,7 @@ defmodule MemexWeb.InviteLiveTest do
|
|||||||
# |> form("#invite-form", invite: @invalid_attrs)
|
# |> form("#invite-form", invite: @invalid_attrs)
|
||||||
# |> render_change() =~ dgettext("errors", "can't be blank")
|
# |> render_change() =~ dgettext("errors", "can't be blank")
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#invite-form", invite: @create_attrs)
|
|> form("#invite-form", invite: @create_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -64,7 +64,7 @@ defmodule MemexWeb.InviteLiveTest do
|
|||||||
# |> form("#invite-form", invite: @invalid_attrs)
|
# |> form("#invite-form", invite: @invalid_attrs)
|
||||||
# |> render_change() =~ dgettext("errors", "can't be blank")
|
# |> render_change() =~ dgettext("errors", "can't be blank")
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#invite-form", invite: @update_attrs)
|
|> form("#invite-form", invite: @update_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
|
@ -24,8 +24,8 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
"visibility" => nil
|
"visibility" => nil
|
||||||
}
|
}
|
||||||
|
|
||||||
defp create_note(%{current_user: current_user}) do
|
defp create_note(%{user: user}) do
|
||||||
[note: note_fixture(current_user)]
|
[note: note_fixture(user)]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Index" do
|
describe "Index" do
|
||||||
@ -62,7 +62,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
assert html =~ "can't be blank"
|
assert html =~ "can't be blank"
|
||||||
assert html =~ "tags must be comma-delimited"
|
assert html =~ "tags must be comma-delimited"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#note-form", note: @create_attrs)
|
|> form("#note-form", note: @create_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -84,7 +84,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
|> form("#note-form", note: @invalid_attrs)
|
|> form("#note-form", note: @invalid_attrs)
|
||||||
|> render_change() =~ "can't be blank"
|
|> render_change() =~ "can't be blank"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#note-form", note: @update_attrs)
|
|> form("#note-form", note: @update_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -123,7 +123,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
|> form("#note-form", note: @invalid_attrs)
|
|> form("#note-form", note: @invalid_attrs)
|
||||||
|> render_change() =~ "can't be blank"
|
|> render_change() =~ "can't be blank"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
show_live
|
show_live
|
||||||
|> form("#note-form", note: Map.put(@update_attrs, "slug", note.slug))
|
|> form("#note-form", note: Map.put(@update_attrs, "slug", note.slug))
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -149,13 +149,13 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
describe "show with note" do
|
describe "show with note" do
|
||||||
setup [:register_and_log_in_user]
|
setup [:register_and_log_in_user]
|
||||||
|
|
||||||
setup %{current_user: current_user} do
|
setup %{user: user} do
|
||||||
%{slug: note_slug} = note = note_fixture(current_user)
|
%{slug: note_slug} = note = note_fixture(user)
|
||||||
|
|
||||||
[
|
[
|
||||||
note: note,
|
note: note,
|
||||||
backlinked_note:
|
backlinked_note:
|
||||||
note_fixture(%{content: "example with backlink to [[#{note_slug}]] note"}, current_user)
|
note_fixture(%{content: "example with backlink to [[#{note_slug}]] note"}, user)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
"title" => nil
|
"title" => nil
|
||||||
}
|
}
|
||||||
|
|
||||||
defp create_pipeline(%{current_user: current_user}) do
|
defp create_pipeline(%{user: user}) do
|
||||||
[pipeline: pipeline_fixture(current_user)]
|
[pipeline: pipeline_fixture(user)]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Index" do
|
describe "Index" do
|
||||||
@ -68,7 +68,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
|> form("#pipeline-form", pipeline: @invalid_attrs)
|
|> form("#pipeline-form", pipeline: @invalid_attrs)
|
||||||
|> render_change() =~ "can't be blank"
|
|> render_change() =~ "can't be blank"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#pipeline-form", pipeline: @create_attrs)
|
|> form("#pipeline-form", pipeline: @create_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -90,7 +90,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
|> form("#pipeline-form", pipeline: @invalid_attrs)
|
|> form("#pipeline-form", pipeline: @invalid_attrs)
|
||||||
|> render_change() =~ "can't be blank"
|
|> render_change() =~ "can't be blank"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
index_live
|
index_live
|
||||||
|> form("#pipeline-form", pipeline: @update_attrs)
|
|> form("#pipeline-form", pipeline: @update_attrs)
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -136,7 +136,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
assert html =~ "can't be blank"
|
assert html =~ "can't be blank"
|
||||||
assert html =~ "tags must be comma-delimited"
|
assert html =~ "tags must be comma-delimited"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _, html} =
|
||||||
show_live
|
show_live
|
||||||
|> form("#pipeline-form", pipeline: Map.put(@update_attrs, "slug", pipeline.slug))
|
|> form("#pipeline-form", pipeline: Map.put(@update_attrs, "slug", pipeline.slug))
|
||||||
|> render_submit()
|
|> render_submit()
|
||||||
@ -181,9 +181,9 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
describe "show with a step" do
|
describe "show with a step" do
|
||||||
setup [:register_and_log_in_user, :create_pipeline]
|
setup [:register_and_log_in_user, :create_pipeline]
|
||||||
|
|
||||||
setup %{pipeline: pipeline, current_user: current_user} do
|
setup %{pipeline: pipeline, user: user} do
|
||||||
[
|
[
|
||||||
step: step_fixture(0, pipeline, current_user)
|
step: step_fixture(0, pipeline, user)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -236,11 +236,11 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
describe "show with multiple steps" do
|
describe "show with multiple steps" do
|
||||||
setup [:register_and_log_in_user, :create_pipeline]
|
setup [:register_and_log_in_user, :create_pipeline]
|
||||||
|
|
||||||
setup %{pipeline: pipeline, current_user: current_user} do
|
setup %{pipeline: pipeline, user: user} do
|
||||||
[
|
[
|
||||||
first_step: step_fixture(%{title: "first step"}, 0, pipeline, current_user),
|
first_step: step_fixture(%{title: "first step"}, 0, pipeline, user),
|
||||||
second_step: step_fixture(%{title: "second step"}, 1, pipeline, current_user),
|
second_step: step_fixture(%{title: "second step"}, 1, pipeline, user),
|
||||||
third_step: step_fixture(%{title: "third step"}, 2, pipeline, current_user)
|
third_step: step_fixture(%{title: "third step"}, 2, pipeline, user)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,11 +5,12 @@ defmodule MemexWeb.ErrorViewTest do
|
|||||||
|
|
||||||
use MemexWeb.ConnCase, async: true
|
use MemexWeb.ConnCase, async: true
|
||||||
import MemexWeb.Gettext
|
import MemexWeb.Gettext
|
||||||
# Bring render/3 and render_to_string/3 for testing custom views
|
|
||||||
import Phoenix.View
|
|
||||||
|
|
||||||
@moduletag :error_view_test
|
@moduletag :error_view_test
|
||||||
|
|
||||||
|
# Bring render/3 and render_to_string/3 for testing custom views
|
||||||
|
import Phoenix.View
|
||||||
|
|
||||||
test "renders 404.html" do
|
test "renders 404.html" do
|
||||||
assert render_to_string(MemexWeb.ErrorView, "404.html", []) =~
|
assert render_to_string(MemexWeb.ErrorView, "404.html", []) =~
|
||||||
dgettext("errors", "not found")
|
dgettext("errors", "not found")
|
||||||
|
@ -23,12 +23,10 @@ defmodule MemexWeb.ConnCase do
|
|||||||
using do
|
using do
|
||||||
quote do
|
quote do
|
||||||
# Import conveniences for testing with connections
|
# Import conveniences for testing with connections
|
||||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
import Plug.Conn
|
||||||
|
import Phoenix.ConnTest
|
||||||
import Memex.Fixtures
|
import Memex.Fixtures
|
||||||
import MemexWeb.ConnCase
|
import MemexWeb.ConnCase
|
||||||
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
|
|
||||||
import Phoenix.ConnTest
|
|
||||||
import Plug.Conn
|
|
||||||
|
|
||||||
alias MemexWeb.Router.Helpers, as: Routes
|
alias MemexWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
@ -52,10 +50,10 @@ defmodule MemexWeb.ConnCase do
|
|||||||
test context.
|
test context.
|
||||||
"""
|
"""
|
||||||
@spec register_and_log_in_user(%{conn: Plug.Conn.t()}) ::
|
@spec register_and_log_in_user(%{conn: Plug.Conn.t()}) ::
|
||||||
%{conn: Plug.Conn.t(), current_user: User.t()}
|
%{conn: Plug.Conn.t(), user: User.t()}
|
||||||
def register_and_log_in_user(%{conn: conn}) do
|
def register_and_log_in_user(%{conn: conn}) do
|
||||||
current_user = user_fixture() |> confirm_user()
|
user = user_fixture() |> confirm_user()
|
||||||
%{conn: log_in_user(conn, current_user), current_user: current_user}
|
%{conn: log_in_user(conn, user), user: user}
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec confirm_user(User.t()) :: User.t()
|
@spec confirm_user(User.t()) :: User.t()
|
||||||
|
@ -22,8 +22,10 @@ defmodule Memex.DataCase do
|
|||||||
alias Memex.Repo
|
alias Memex.Repo
|
||||||
|
|
||||||
import Ecto
|
import Ecto
|
||||||
import Ecto.{Changeset, Query}
|
import Ecto.Changeset
|
||||||
import Memex.{DataCase, Fixtures}
|
import Ecto.Query
|
||||||
|
import Memex.DataCase
|
||||||
|
import Memex.Fixtures
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ defmodule Memex.DataCase do
|
|||||||
"""
|
"""
|
||||||
def errors_on(changeset) do
|
def errors_on(changeset) do
|
||||||
Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
|
Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
|
||||||
Regex.replace(~r"%{(\w+)}", message, fn _capture, key ->
|
Regex.replace(~r"%{(\w+)}", message, fn _, key ->
|
||||||
opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string()
|
opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user