Merge branch 'master' into 'master'
(Hopefully) improve grammar See merge request framasoft/mobilizon!273
This commit is contained in:
commit
c836f17345
@ -301,7 +301,7 @@
|
|||||||
"Your account has been validated": "Your account has been validated",
|
"Your account has been validated": "Your account has been validated",
|
||||||
"Your account is being validated": "Your account is being validated",
|
"Your account is being validated": "Your account is being validated",
|
||||||
"Your account is nearly ready, {username}": "Your account is nearly ready, {username}",
|
"Your account is nearly ready, {username}": "Your account is nearly ready, {username}",
|
||||||
"Your local administrator resumed it's policy:": "Your local administrator resumed it's policy:",
|
"Your local administrator resumed its policy:": "Your local administrator resumed its policy:",
|
||||||
"Your participation has been confirmed": "Your participation has been confirmed",
|
"Your participation has been confirmed": "Your participation has been confirmed",
|
||||||
"Your participation has been requested": "Your participation has been requested",
|
"Your participation has been requested": "Your participation has been requested",
|
||||||
"a decentralised federation protocol": "a decentralised federation protocol",
|
"a decentralised federation protocol": "a decentralised federation protocol",
|
||||||
|
@ -301,7 +301,7 @@
|
|||||||
"Your account has been validated": "Votre compte a été validé",
|
"Your account has been validated": "Votre compte a été validé",
|
||||||
"Your account is being validated": "Votre compte est en cours de validation",
|
"Your account is being validated": "Votre compte est en cours de validation",
|
||||||
"Your account is nearly ready, {username}": "Votre compte est presque prêt, {username}",
|
"Your account is nearly ready, {username}": "Votre compte est presque prêt, {username}",
|
||||||
"Your local administrator resumed it's policy:": "Votre administrateur local a résumé sa politique ainsi :",
|
"Your local administrator resumed its policy:": "Votre administrateur local a résumé sa politique ainsi :",
|
||||||
"Your participation has been confirmed": "Votre participation a été confirmée",
|
"Your participation has been confirmed": "Votre participation a été confirmée",
|
||||||
"Your participation has been requested": "Votre participation a été demandée",
|
"Your participation has been requested": "Votre participation a été demandée",
|
||||||
"a decentralised federation protocol": "un protocole de fédération décentralisée",
|
"a decentralised federation protocol": "un protocole de fédération décentralisée",
|
||||||
|
@ -226,7 +226,7 @@
|
|||||||
"Disallow promoting on Mobilizon": "Refusar la promocion sus Mobilizon",
|
"Disallow promoting on Mobilizon": "Refusar la promocion sus Mobilizon",
|
||||||
"with {identity}": "amb {identity}",
|
"with {identity}": "amb {identity}",
|
||||||
"with another identity…": "amb una autra identitat…",
|
"with another identity…": "amb una autra identitat…",
|
||||||
"Your local administrator resumed it's policy:": "Vòstre administrator local resumèt sa politica aital :",
|
"Your local administrator resumed its policy:": "Vòstre administrator local resumèt sa politica aital :",
|
||||||
"Your account is nearly ready, {username}": "Vòstre compte es gaireben prèst, {username}",
|
"Your account is nearly ready, {username}": "Vòstre compte es gaireben prèst, {username}",
|
||||||
"You're not going to any event yet": "Avètz pas cap d’eveniment pel moment",
|
"You're not going to any event yet": "Avètz pas cap d’eveniment pel moment",
|
||||||
"You have one event tomorrow.": "Avètz pas cap d’eveniment deman| Avètz un eveniment deman. | Avètz {count} eveniments deman",
|
"You have one event tomorrow.": "Avètz pas cap d’eveniment deman| Avètz un eveniment deman. | Avètz {count} eveniments deman",
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<h2 class="title">{{ $t('About this instance') }}</h2>
|
<h2 class="title">{{ $t('About this instance') }}</h2>
|
||||||
<p>
|
<p>
|
||||||
{{ $t("Your local administrator resumed it's policy:") }}
|
{{ $t("Your local administrator resumed its policy:") }}
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{ $t('Enjoy discovering Mobilizon!') }}</li>
|
<li>{{ $t('Enjoy discovering Mobilizon!') }}</li>
|
||||||
|
@ -24,7 +24,7 @@ defmodule Mobilizon.Media do
|
|||||||
def get_picture!(id), do: Repo.get!(Picture, id)
|
def get_picture!(id), do: Repo.get!(Picture, id)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Get a picture by it's URL.
|
Get a picture by its URL.
|
||||||
"""
|
"""
|
||||||
@spec get_picture_by_url(String.t()) :: Picture.t() | nil
|
@spec get_picture_by_url(String.t()) :: Picture.t() | nil
|
||||||
def get_picture_by_url(url) do
|
def get_picture_by_url(url) do
|
||||||
|
@ -172,7 +172,7 @@ defmodule MobilizonWeb.Resolvers.Event do
|
|||||||
{:ok, participant}
|
{:ok, participant}
|
||||||
else
|
else
|
||||||
{:maximum_attendee_capacity, _} ->
|
{:maximum_attendee_capacity, _} ->
|
||||||
{:error, "The event has already reached it's maximum capacity"}
|
{:error, "The event has already reached its maximum capacity"}
|
||||||
|
|
||||||
{:has_event, _} ->
|
{:has_event, _} ->
|
||||||
{:error, "Event with this ID #{inspect(event_id)} doesn't exist"}
|
{:error, "Event with this ID #{inspect(event_id)} doesn't exist"}
|
||||||
@ -329,7 +329,7 @@ defmodule MobilizonWeb.Resolvers.Event do
|
|||||||
|
|
||||||
# If we have an attached picture, just transmit it. It will be handled by
|
# If we have an attached picture, just transmit it. It will be handled by
|
||||||
# Mobilizon.Service.ActivityPub.Utils.make_picture_data/1
|
# Mobilizon.Service.ActivityPub.Utils.make_picture_data/1
|
||||||
# However, we need to pass it's actor ID
|
# However, we need to pass its actor ID
|
||||||
@spec save_attached_picture(map()) :: {:ok, map()}
|
@spec save_attached_picture(map()) :: {:ok, map()}
|
||||||
defp save_attached_picture(
|
defp save_attached_picture(
|
||||||
%{picture: %{picture: %{file: %Plug.Upload{} = _picture} = all_pic}} = args
|
%{picture: %{picture: %{file: %Plug.Upload{} = _picture} = all_pic}} = args
|
||||||
|
@ -14,7 +14,7 @@ defmodule MobilizonWeb.Resolvers.User do
|
|||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Find an user by it's ID
|
Find an user by its ID
|
||||||
"""
|
"""
|
||||||
def find_user(_parent, %{id: id}, _resolution) do
|
def find_user(_parent, %{id: id}, _resolution) do
|
||||||
Users.get_user_with_actors(id)
|
Users.get_user_with_actors(id)
|
||||||
@ -128,7 +128,7 @@ defmodule MobilizonWeb.Resolvers.User do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Validate an user, get it's actor and a token
|
Validate an user, get its actor and a token
|
||||||
"""
|
"""
|
||||||
def validate_user(_parent, %{token: token}, _resolution) do
|
def validate_user(_parent, %{token: token}, _resolution) do
|
||||||
with {:check_confirmation_token, {:ok, %User{} = user}} <-
|
with {:check_confirmation_token, {:ok, %User{} = user}} <-
|
||||||
|
@ -89,7 +89,7 @@ defmodule MobilizonWeb.Schema.Actors.GroupType do
|
|||||||
resolve(&Group.list_groups/3)
|
resolve(&Group.list_groups/3)
|
||||||
end
|
end
|
||||||
|
|
||||||
@desc "Get a group by it's preferred username"
|
@desc "Get a group by its preferred username"
|
||||||
field :group, :group do
|
field :group, :group do
|
||||||
arg(:preferred_username, non_null(:string))
|
arg(:preferred_username, non_null(:string))
|
||||||
resolve(&Group.find_group/3)
|
resolve(&Group.find_group/3)
|
||||||
|
@ -70,13 +70,13 @@ defmodule MobilizonWeb.Schema.Actors.PersonType do
|
|||||||
resolve(&Person.get_current_person/3)
|
resolve(&Person.get_current_person/3)
|
||||||
end
|
end
|
||||||
|
|
||||||
@desc "Get a person by it's (federated) username"
|
@desc "Get a person by its (federated) username"
|
||||||
field :fetch_person, :person do
|
field :fetch_person, :person do
|
||||||
arg(:preferred_username, non_null(:string))
|
arg(:preferred_username, non_null(:string))
|
||||||
resolve(&Person.fetch_person/3)
|
resolve(&Person.fetch_person/3)
|
||||||
end
|
end
|
||||||
|
|
||||||
@desc "Get a person by it's ID"
|
@desc "Get a person by its ID"
|
||||||
field :person, :person do
|
field :person, :person do
|
||||||
arg(:id, non_null(:id))
|
arg(:id, non_null(:id))
|
||||||
resolve(&Person.get_person/3)
|
resolve(&Person.get_person/3)
|
||||||
|
@ -480,7 +480,7 @@ defmodule Mobilizon.Service.ActivityPub do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Create an actor locally by it's URL (AP ID)
|
Create an actor locally by its URL (AP ID)
|
||||||
"""
|
"""
|
||||||
@spec make_actor_from_url(String.t(), boolean()) :: {:ok, %Actor{}} | {:error, any()}
|
@spec make_actor_from_url(String.t(), boolean()) :: {:ok, %Actor{}} | {:error, any()}
|
||||||
def make_actor_from_url(url, preload \\ false) do
|
def make_actor_from_url(url, preload \\ false) do
|
||||||
@ -520,7 +520,7 @@ defmodule Mobilizon.Service.ActivityPub do
|
|||||||
def find_or_make_group_from_nickname(nick), do: find_or_make_actor_from_nickname(nick, :Group)
|
def find_or_make_group_from_nickname(nick), do: find_or_make_actor_from_nickname(nick, :Group)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Create an actor inside our database from username, using WebFinger to find out it's AP ID and then fetch it
|
Create an actor inside our database from username, using WebFinger to find out its AP ID and then fetch it
|
||||||
"""
|
"""
|
||||||
@spec make_actor_from_nickname(String.t()) :: {:ok, %Actor{}} | {:error, any()}
|
@spec make_actor_from_nickname(String.t()) :: {:ok, %Actor{}} | {:error, any()}
|
||||||
def make_actor_from_nickname(nickname) do
|
def make_actor_from_nickname(nickname) do
|
||||||
@ -611,7 +611,7 @@ defmodule Mobilizon.Service.ActivityPub do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fetching a remote actor's information through it's AP ID
|
# Fetching a remote actor's information through its AP ID
|
||||||
@spec fetch_and_prepare_actor_from_url(String.t()) :: {:ok, struct()} | {:error, atom()} | any()
|
@spec fetch_and_prepare_actor_from_url(String.t()) :: {:ok, struct()} | {:error, atom()} | any()
|
||||||
defp fetch_and_prepare_actor_from_url(url) do
|
defp fetch_and_prepare_actor_from_url(url) do
|
||||||
Logger.debug("Fetching and preparing actor from url")
|
Logger.debug("Fetching and preparing actor from url")
|
||||||
|
@ -54,7 +54,7 @@ defmodule Mobilizon.Service.Export.Feed do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Build an atom feed from actor and it's public events
|
# Build an atom feed from actor and its public events
|
||||||
@spec build_actor_feed(Actor.t(), list(), boolean()) :: String.t()
|
@spec build_actor_feed(Actor.t(), list(), boolean()) :: String.t()
|
||||||
defp build_actor_feed(%Actor{} = actor, events, public \\ true) do
|
defp build_actor_feed(%Actor{} = actor, events, public \\ true) do
|
||||||
display_name = Actor.display_name(actor)
|
display_name = Actor.display_name(actor)
|
||||||
@ -159,7 +159,7 @@ defmodule Mobilizon.Service.Export.Feed do
|
|||||||
|> Enum.map(&Events.get_event_with_preload!/1)
|
|> Enum.map(&Events.get_event_with_preload!/1)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Build an atom feed from actor and it's public events
|
# Build an atom feed from actor and its public events
|
||||||
@spec build_user_feed(list(), User.t(), String.t()) :: String.t()
|
@spec build_user_feed(list(), User.t(), String.t()) :: String.t()
|
||||||
defp build_user_feed(events, %User{email: email}, token) do
|
defp build_user_feed(events, %User{email: email}, token) do
|
||||||
self_url = Endpoint |> Routes.feed_url(:going, token, "atom") |> URI.decode()
|
self_url = Endpoint |> Routes.feed_url(:going, token, "atom") |> URI.decode()
|
||||||
|
@ -1134,10 +1134,10 @@ type RootQueryType {
|
|||||||
"""Get all events"""
|
"""Get all events"""
|
||||||
events(limit: Int = 10, page: Int = 1): [Event]
|
events(limit: Int = 10, page: Int = 1): [Event]
|
||||||
|
|
||||||
"""Get a person by it's (federated) username"""
|
"""Get a person by its (federated) username"""
|
||||||
fetchPerson(preferredUsername: String!): Person
|
fetchPerson(preferredUsername: String!): Person
|
||||||
|
|
||||||
"""Get a group by it's preferred username"""
|
"""Get a group by its preferred username"""
|
||||||
group(preferredUsername: String!): Group
|
group(preferredUsername: String!): Group
|
||||||
|
|
||||||
"""Get all groups"""
|
"""Get all groups"""
|
||||||
@ -1152,7 +1152,7 @@ type RootQueryType {
|
|||||||
"""Get the current user"""
|
"""Get the current user"""
|
||||||
loggedUser: User
|
loggedUser: User
|
||||||
|
|
||||||
"""Get a person by it's ID"""
|
"""Get a person by its ID"""
|
||||||
person(id: ID!): Person
|
person(id: ID!): Person
|
||||||
|
|
||||||
"""Get a picture"""
|
"""Get a picture"""
|
||||||
|
@ -72,7 +72,7 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
assert actor_id == Users.get_actor_for_user(user).id
|
assert actor_id == Users.get_actor_for_user(user).id
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get_actor_with_preload/1 returns the actor with it's organized events", %{
|
test "get_actor_with_preload/1 returns the actor with its organized events", %{
|
||||||
actor: actor
|
actor: actor
|
||||||
} do
|
} do
|
||||||
assert Actors.get_actor_with_preload(actor.id).organized_events == []
|
assert Actors.get_actor_with_preload(actor.id).organized_events == []
|
||||||
@ -113,7 +113,7 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get_local_actor_by_name_with_preload!/1 returns the local actor with it's organized events",
|
test "get_local_actor_by_name_with_preload!/1 returns the local actor with its organized events",
|
||||||
%{
|
%{
|
||||||
actor: actor
|
actor: actor
|
||||||
} do
|
} do
|
||||||
@ -130,7 +130,7 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
assert event_found_id == event.id
|
assert event_found_id == event.id
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get_actor_by_name_with_preload!/1 returns the local actor with it's organized events",
|
test "get_actor_by_name_with_preload!/1 returns the local actor with its organized events",
|
||||||
%{
|
%{
|
||||||
actor: actor
|
actor: actor
|
||||||
} do
|
} do
|
||||||
@ -147,7 +147,7 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
assert event_found_id == event.id
|
assert event_found_id == event.id
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get_actor_by_name_with_preload!/1 returns the remote actor with it's organized events" do
|
test "get_actor_by_name_with_preload!/1 returns the remote actor with its organized events" do
|
||||||
use_cassette "actors/remote_actor_mastodon_tcit" do
|
use_cassette "actors/remote_actor_mastodon_tcit" do
|
||||||
with {:ok, %Actor{} = actor} <- ActivityPub.get_or_fetch_by_url(@remote_account_url) do
|
with {:ok, %Actor{} = actor} <- ActivityPub.get_or_fetch_by_url(@remote_account_url) do
|
||||||
assert Actors.get_actor_by_name_with_preload(
|
assert Actors.get_actor_by_name_with_preload(
|
||||||
@ -230,7 +230,7 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
refute actor.suspended
|
refute actor.suspended
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update_actor/2 with valid data updates the actor and it's media files", %{
|
test "update_actor/2 with valid data updates the actor and its media files", %{
|
||||||
actor: %Actor{avatar: %{url: avatar_url}, banner: %{url: banner_url}} = actor
|
actor: %Actor{avatar: %{url: avatar_url}, banner: %{url: banner_url}} = actor
|
||||||
} do
|
} do
|
||||||
%URI{path: "/media/" <> avatar_path} = URI.parse(avatar_url)
|
%URI{path: "/media/" <> avatar_path} = URI.parse(avatar_url)
|
||||||
|
@ -42,7 +42,7 @@ defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "fetching actor from it's url" do
|
describe "fetching actor from its url" do
|
||||||
test "returns an actor from nickname" do
|
test "returns an actor from nickname" do
|
||||||
use_cassette "activity_pub/fetch_tcit@framapiaf.org" do
|
use_cassette "activity_pub/fetch_tcit@framapiaf.org" do
|
||||||
assert {:ok, %Actor{preferred_username: "tcit", domain: "framapiaf.org"} = actor} =
|
assert {:ok, %Actor{preferred_username: "tcit", domain: "framapiaf.org"} = actor} =
|
||||||
|
@ -74,7 +74,7 @@ defmodule Mobilizon.UsersTest do
|
|||||||
Users.authenticate(%{user: user, password: "bad password"})
|
Users.authenticate(%{user: user, password: "bad password"})
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get_user_by_email/1 finds an user by it's email" do
|
test "get_user_by_email/1 finds an user by its email" do
|
||||||
{:ok, %User{email: email} = user} = Users.register(%{email: @email, password: @password})
|
{:ok, %User{email: email} = user} = Users.register(%{email: @email, password: @password})
|
||||||
|
|
||||||
assert email == @email
|
assert email == @email
|
||||||
@ -83,7 +83,7 @@ defmodule Mobilizon.UsersTest do
|
|||||||
assert {:error, :user_not_found} = Users.get_user_by_email("no email")
|
assert {:error, :user_not_found} = Users.get_user_by_email("no email")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get_user_by_email/1 finds an activated user by it's email" do
|
test "get_user_by_email/1 finds an activated user by its email" do
|
||||||
{:ok, %User{} = user} = Users.register(%{email: @email, password: @password})
|
{:ok, %User{} = user} = Users.register(%{email: @email, password: @password})
|
||||||
|
|
||||||
{:ok, %User{id: id}} = Users.get_user_by_email(@email, false)
|
{:ok, %User{id: id}} = Users.get_user_by_email(@email, false)
|
||||||
|
@ -106,7 +106,7 @@ defmodule MobilizonWeb.Resolvers.GroupResolverTest do
|
|||||||
group.preferred_username
|
group.preferred_username
|
||||||
end
|
end
|
||||||
|
|
||||||
test "find_group/3 returns a group by it's username", context do
|
test "find_group/3 returns a group by its username", context do
|
||||||
group = insert(:group)
|
group = insert(:group)
|
||||||
|
|
||||||
query = """
|
query = """
|
||||||
|
@ -141,7 +141,7 @@ defmodule MobilizonWeb.Resolvers.ParticipantResolverTest do
|
|||||||
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
|
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
|
||||||
|
|
||||||
assert hd(json_response(res, 200)["errors"])["message"] ==
|
assert hd(json_response(res, 200)["errors"])["message"] ==
|
||||||
"The event has already reached it's maximum capacity"
|
"The event has already reached its maximum capacity"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "actor_join_event/3 should check the actor is owned by the user", %{
|
test "actor_join_event/3 should check the actor is owned by the user", %{
|
||||||
|
@ -7,7 +7,7 @@ defmodule MobilizonWeb.Resolvers.PersonResolverTest do
|
|||||||
@non_existent_username "nonexistent"
|
@non_existent_username "nonexistent"
|
||||||
|
|
||||||
describe "Person Resolver" do
|
describe "Person Resolver" do
|
||||||
test "get_person/3 returns a person by it's username", context do
|
test "get_person/3 returns a person by its username", context do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
actor = insert(:actor, user: user)
|
actor = insert(:actor, user: user)
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ defmodule MobilizonWeb.Resolvers.PersonResolverTest do
|
|||||||
"Person with ID 6895567 not found"
|
"Person with ID 6895567 not found"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "find_person/3 returns a person by it's username", context do
|
test "find_person/3 returns a person by its username", context do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
actor = insert(:actor, user: user)
|
actor = insert(:actor, user: user)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
|
|||||||
@valid_single_actor_params %{preferred_username: "test2", keys: "yolo"}
|
@valid_single_actor_params %{preferred_username: "test2", keys: "yolo"}
|
||||||
|
|
||||||
describe "Resolver: Get an user" do
|
describe "Resolver: Get an user" do
|
||||||
test "find_user/3 returns an user by it's id", context do
|
test "find_user/3 returns an user by its id", context do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
query = """
|
query = """
|
||||||
|
Loading…
Reference in New Issue
Block a user