Replace Vuetify with Bulma
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Remove vuetify and add Bulma Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -42,7 +42,7 @@ defmodule Mobilizon.Actors.Actor do
|
||||
field(:shared_inbox_url, :string)
|
||||
field(:type, Mobilizon.Actors.ActorTypeEnum, default: :Person)
|
||||
field(:name, :string)
|
||||
field(:domain, :string)
|
||||
field(:domain, :string, default: nil)
|
||||
field(:summary, :string)
|
||||
field(:preferred_username, :string)
|
||||
field(:keys, :string)
|
||||
|
||||
@@ -77,9 +77,30 @@ defmodule Mobilizon.Actors do
|
||||
Repo.all(from(a in Actor, where: a.user_id == ^user_id))
|
||||
end
|
||||
|
||||
def get_actor_with_everything!(id) do
|
||||
actor = Repo.get!(Actor, id)
|
||||
Repo.preload(actor, [:organized_events, :followers, :followings])
|
||||
@spec get_actor_with_everything(integer()) :: Ecto.Query
|
||||
defp do_get_actor_with_everything(id) do
|
||||
from(a in Actor, where: a.id == ^id, preload: [:organized_events, :followers, :followings])
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an actor with every relation
|
||||
"""
|
||||
@spec get_actor_with_everything(integer()) :: Mobilizon.Actors.Actor.t()
|
||||
def get_actor_with_everything(id) do
|
||||
id
|
||||
|> do_get_actor_with_everything
|
||||
|> Repo.one()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an actor with every relation
|
||||
"""
|
||||
@spec get_local_actor_with_everything(integer()) :: Mobilizon.Actors.Actor.t()
|
||||
def get_local_actor_with_everything(id) do
|
||||
id
|
||||
|> do_get_actor_with_everything
|
||||
|> where([a], is_nil(a.domain))
|
||||
|> Repo.one()
|
||||
end
|
||||
|
||||
@doc """
|
||||
@@ -610,6 +631,19 @@ defmodule Mobilizon.Actors do
|
||||
{:error, hd(email_msg)}
|
||||
end
|
||||
|
||||
@doc """
|
||||
Create a new person actor
|
||||
"""
|
||||
def new_person(args) do
|
||||
key = :public_key.generate_key({:rsa, 2048, 65_537})
|
||||
entry = :public_key.pem_entry_encode(:RSAPrivateKey, key)
|
||||
pem = [entry] |> :public_key.pem_encode() |> String.trim_trailing()
|
||||
args = Map.put(args, :keys, pem)
|
||||
|
||||
actor = Mobilizon.Actors.Actor.registration_changeset(%Mobilizon.Actors.Actor{}, args)
|
||||
Mobilizon.Repo.insert(actor)
|
||||
end
|
||||
|
||||
def register_bot_account(%{name: name, summary: summary}) do
|
||||
key = :public_key.generate_key({:rsa, 2048, 65_537})
|
||||
entry = :public_key.pem_entry_encode(:RSAPrivateKey, key)
|
||||
|
||||
@@ -24,10 +24,12 @@ defmodule Mobilizon.Actors.Service.ResetPassword do
|
||||
{:ok, user}
|
||||
else
|
||||
{:error, %Ecto.Changeset{errors: [password: {"registration.error.password_too_short", _}]}} ->
|
||||
{:error, :password_too_short}
|
||||
{:error,
|
||||
"The password you have choosen is too short. Please make sure your password contains at least 6 charaters."}
|
||||
|
||||
_err ->
|
||||
{:error, :invalid_token}
|
||||
{:error,
|
||||
"The token you provided is invalid. Make sure that the URL is exactly the one provided inside the email you got."}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user