diff --git a/lib/graphql/resolvers/person.ex b/lib/graphql/resolvers/person.ex index 138a8526d..31a0f1c5a 100644 --- a/lib/graphql/resolvers/person.ex +++ b/lib/graphql/resolvers/person.ex @@ -296,58 +296,6 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do end end - @doc """ - This function is used to register a person afterwards the user has been created (but not activated) - """ - @spec register_person(any(), map(), Absinthe.Resolution.t()) :: - {:ok, Actor.t()} | {:error, String.t()} - def register_person(_parent, args, %{context: context}) do - current_ip = Map.get(context, :ip) - user_agent = Map.get(context, :user_agent, "") - - # When registering, email is assumed confirmed (unlike changing email) - case Users.get_user_by_email(args.email, unconfirmed: false) do - {:ok, %User{} = user} -> - if is_nil(Users.get_actor_for_user(user)) do - # No profile yet, we can create one - with {:spam, :ham} <- - {:spam, - AntiSpam.service().check_profile( - args.preferred_username, - args.summary, - args.email, - current_ip, - user_agent - )}, - args when is_map(args) <- prepare_args(args, user) do - Actors.new_person(args, true) - else - {:error, :file_too_large} -> - {:error, dgettext("errors", "The provided picture is too heavy")} - - {:error, _err} -> - {:error, dgettext("errors", "Error while uploading pictures")} - - {:spam, _} -> - {:error, dgettext("errors", "Your profile was detected as spam.")} - end - else - {:error, dgettext("errors", "You already have a profile for this user")} - end - - {:error, :user_not_found} -> - {:error, dgettext("errors", "No user with this email was found")} - end - end - - @spec prepare_args(map(), User.t()) :: map() | {:error, any()} - defp prepare_args(args, %User{} = user) do - args - |> Map.update(:preferred_username, "", &String.downcase/1) - |> Map.put(:user_id, user.id) - |> save_attached_pictures() - end - @doc """ Returns the participations, optionally restricted to an event """ diff --git a/lib/graphql/schema/actors/person.ex b/lib/graphql/schema/actors/person.ex index 8ef0178b3..f9287bbcc 100644 --- a/lib/graphql/schema/actors/person.ex +++ b/lib/graphql/schema/actors/person.ex @@ -299,37 +299,6 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do resolve(&Person.delete_person/3) end - - @desc "Register a first profile on registration" - field :register_person, :person do - arg(:preferred_username, non_null(:string), description: "The username for the profile") - - arg(:name, :string, - description: "The displayed name for the new profile", - default_value: "" - ) - - arg(:summary, :string, description: "The summary for the new profile", default_value: "") - arg(:email, non_null(:string), description: "The email from the user previously created") - - arg(:avatar, :media_input, - description: - "The avatar for the profile, either as an object or directly the ID of an existing media" - ) - - arg(:banner, :media_input, - description: - "The banner for the profile, either as an object or directly the ID of an existing media" - ) - - middleware(Rajska.QueryAuthorization, - permit: :all, - scope: Mobilizon.Actors.Actor, - args: %{} - ) - - resolve(&Person.register_person/3) - end end object :person_subscriptions do diff --git a/src/App.vue b/src/App.vue index 80d16f49f..9c0861b08 100644 --- a/src/App.vue +++ b/src/App.vue @@ -151,11 +151,7 @@ onBeforeMount(async () => { } catch (err) { if (err instanceof NoIdentitiesException) { await router.push({ - name: RouteName.REGISTER_PROFILE, - params: { - email: localStorage.getItem(AUTH_USER_EMAIL), - userAlreadyActivated: "true", - }, + name: RouteName.CREATE_IDENTITY, }); } else { throw err; diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index bf042287f..e348446c5 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -13,7 +13,7 @@
{{ - displayName(currentActor) + displayName(currentActor) || currentUser.email }} -
  • +
  • {{ t("Login") }}
  • -
  • +
  • { "We have no identities listed for current user", identities.value ); - console.info("Pushing route to REGISTER_PROFILE"); + console.info("Pushing route to CREATE_IDENTITY"); router.push({ - name: RouteName.REGISTER_PROFILE, - params: { - email: currentUser.value?.email, - userAlreadyActivated: "true", - }, + name: RouteName.CREATE_IDENTITY, }); } }); diff --git a/src/composition/apollo/actor.ts b/src/composition/apollo/actor.ts index 5e2e8a922..0d480513d 100644 --- a/src/composition/apollo/actor.ts +++ b/src/composition/apollo/actor.ts @@ -25,7 +25,13 @@ export function useCurrentActorClient() { export function useLazyCurrentUserIdentities() { return useLazyQuery<{ loggedUser: Pick; - }>(IDENTITIES); + }>( + IDENTITIES, + {}, + { + fetchPolicy: "network-only", + } + ); } export function useCurrentUserIdentities() { diff --git a/src/composition/apollo/user.ts b/src/composition/apollo/user.ts index c2f5033e9..f15fada50 100644 --- a/src/composition/apollo/user.ts +++ b/src/composition/apollo/user.ts @@ -1,4 +1,3 @@ -import { IDENTITIES, REGISTER_PERSON } from "@/graphql/actor"; import { CURRENT_USER_CLIENT, LOGGED_USER_AND_SETTINGS, @@ -6,10 +5,7 @@ import { SET_USER_SETTINGS, UPDATE_USER_LOCALE, } from "@/graphql/user"; -import { IPerson } from "@/types/actor"; import { ICurrentUser, IUser } from "@/types/current-user.model"; -import { ActorType } from "@/types/enums"; -import { ApolloCache, FetchResult } from "@apollo/client/core"; import { useMutation, useQuery } from "@vue/apollo-composable"; import { computed } from "vue"; @@ -65,44 +61,3 @@ export async function doUpdateSetting( export function updateLocale() { return useMutation<{ id: string; locale: string }>(UPDATE_USER_LOCALE); } - -export function registerAccount() { - return useMutation< - { registerPerson: IPerson }, - { - preferredUsername: string; - name: string; - summary: string; - email: string; - } - >(REGISTER_PERSON, () => ({ - update: ( - store: ApolloCache<{ registerPerson: IPerson }>, - { data: localData }: FetchResult, - { context } - ) => { - if (context?.userAlreadyActivated) { - const currentUserData = store.readQuery<{ - loggedUser: Pick; - }>({ - query: IDENTITIES, - }); - - if (currentUserData && localData) { - const newPersonData = { - ...localData.registerPerson, - type: ActorType.PERSON, - }; - - store.writeQuery({ - query: IDENTITIES, - data: { - ...currentUserData.loggedUser, - actors: [[...currentUserData.loggedUser.actors, newPersonData]], - }, - }); - } - } - }, - })); -} diff --git a/src/graphql/actor.ts b/src/graphql/actor.ts index 1f6537860..38d5fcf9f 100644 --- a/src/graphql/actor.ts +++ b/src/graphql/actor.ts @@ -451,29 +451,6 @@ export const DELETE_PERSON = gql` } `; -/** - * This one is used only to register the first account. - * Prefer CREATE_PERSON when creating another identity - */ -export const REGISTER_PERSON = gql` - mutation RegisterPerson( - $preferredUsername: String! - $name: String! - $summary: String! - $email: String! - ) { - registerPerson( - preferredUsername: $preferredUsername - name: $name - summary: $summary - email: $email - ) { - ...ActorFragment - } - } - ${ACTOR_FRAGMENT} -`; - export const SUSPEND_PROFILE = gql` mutation SuspendProfile($id: ID!) { suspendProfile(id: $id) { diff --git a/src/i18n/ar.json b/src/i18n/ar.json index 9ec4a3eb7..746a108cb 100644 --- a/src/i18n/ar.json +++ b/src/i18n/ar.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "تم حذف حسابك بنجاح", "Your account has been validated": "لقد تم تأكيد حسابك", "Your account is being validated": "جارٍ تأكيد حسابك", - "Your account is nearly ready, {username}": "إنّ حسابك جاهز تقريبًا ، يا {username}", + "Your account is nearly ready": "إنّ حسابك جاهز تقريبًا ، يا", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/be.json b/src/i18n/be.json index 3390a620f..0de185812 100644 --- a/src/i18n/be.json +++ b/src/i18n/be.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/bn.json b/src/i18n/bn.json index c6e1faee7..81ce104d2 100644 --- a/src/i18n/bn.json +++ b/src/i18n/bn.json @@ -1119,7 +1119,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/ca.json b/src/i18n/ca.json index 630d46d19..3c1cebf59 100644 --- a/src/i18n/ca.json +++ b/src/i18n/ca.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "S'ha esborrat el teu compte", "Your account has been validated": "El teu compte ha estat validat", "Your account is being validated": "El teu compte està sent validat", - "Your account is nearly ready, {username}": "El teu compte està gairebé apunt, {username}", + "Your account is nearly ready": "El teu compte està gairebé apunt", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "El municipi i el radi només es faran servir per suggerir-te activitats properes. El radi d'activitats es considera des del centre administratiu de l'àrea.", "Your current email is {email}. You use it to log in.": "El teu correu actual és {email}. Fes-lo servir per iniciar sessió.", "Your email": "El teu mail", diff --git a/src/i18n/cs.json b/src/i18n/cs.json index b4ded59de..2736f18a1 100644 --- a/src/i18n/cs.json +++ b/src/i18n/cs.json @@ -1492,7 +1492,7 @@ "Your account has been successfully deleted": "Váš účet byl úspěšně smazán", "Your account has been validated": "Váš účet byl ověřen", "Your account is being validated": "Váš účet je ověřován", - "Your account is nearly ready, {username}": "Váš účet je téměř připraven, {username}", + "Your account is nearly ready": "Váš účet je téměř připraven", "Your application code": "Kód vaší aplikace", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Vaše město nebo oblast a okruh budou použity pouze k tomu, aby vám byly nabídnuty události v okolí. Poloměr události bude brát v úvahu administrativní centrum oblasti.", "Your current email is {email}. You use it to log in.": "Váš aktuální e-mail je {email}. Používáte ho k přihlášení.", diff --git a/src/i18n/cy.json b/src/i18n/cy.json index 39ee466d7..74b300e61 100644 --- a/src/i18n/cy.json +++ b/src/i18n/cy.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/de.json b/src/i18n/de.json index 793f4d6e8..ed293855c 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -1338,7 +1338,7 @@ "Your account has been successfully deleted": "Ihr Konto wurde erfolgreich gelöscht", "Your account has been validated": "Ihr Konto wurde validiert", "Your account is being validated": "Ihr Konto wird geprüft", - "Your account is nearly ready, {username}": "Ihr Konto ist fast bereit, {username}", + "Your account is nearly ready": "Ihr Konto ist fast bereit", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Ihr Ort, Landkreis oder Bundesland wird nur für die Anzeige von Veranstaltungen in der Nähe verwendet. Der Veranstaltungsradius bezieht sich auf den Verwaltungssitz des Gebietes.", "Your current email is {email}. You use it to log in.": "Ihre aktuelle E-Mail-Adresse ist {email}. Sie verwenden sie zum Anmelden.", "Your email": "Ihre E-Mail-Adresse", diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index f1f059d08..7e0c4c6ed 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -383,7 +383,7 @@ "Your account has been successfully deleted": "Your account has been successfully deleted", "Your account has been validated": "Your account has been 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": "Your account is nearly ready", "Your current email is {email}. You use it to log in.": "Your current email is {email}. You use it to log in.", "Your email has been changed": "Your email has been changed", "Your email is being changed": "Your email is being changed", diff --git a/src/i18n/eo.json b/src/i18n/eo.json index b9e7d71c6..6b998f773 100644 --- a/src/i18n/eo.json +++ b/src/i18n/eo.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/es.json b/src/i18n/es.json index a017459d4..49d13b1f7 100644 --- a/src/i18n/es.json +++ b/src/i18n/es.json @@ -1498,7 +1498,7 @@ "Your account has been successfully deleted": "Su cuenta ha sido eliminada exitosamente", "Your account has been validated": "Su cuenta ha sido validada", "Your account is being validated": "Su cuenta esta siendo validada", - "Your account is nearly ready, {username}": "Su cuenta está casi lista, {username}", + "Your account is nearly ready": "Su cuenta está casi lista", "Your application code": "Su código de aplicación", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Su ciudad o región y el radio solo se utilizarán para sugerirle eventos cercanos. El radio del evento considerará el centro administrativo del área.", "Your current email is {email}. You use it to log in.": "Su correo electrónico actual es {correo electrónico}. Lo usas para iniciar sesión.", diff --git a/src/i18n/eu.json b/src/i18n/eu.json index 5f521c9a1..254e17dff 100644 --- a/src/i18n/eu.json +++ b/src/i18n/eu.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/fa.json b/src/i18n/fa.json index 7f8c78ad7..33d9cc8cb 100644 --- a/src/i18n/fa.json +++ b/src/i18n/fa.json @@ -1125,7 +1125,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/fi.json b/src/i18n/fi.json index 328c7eef9..be7180faa 100644 --- a/src/i18n/fi.json +++ b/src/i18n/fi.json @@ -1132,7 +1132,7 @@ "Your account has been successfully deleted": "Tilin poistaminen onnistui", "Your account has been validated": "Tilisi on vahvistettu", "Your account is being validated": "Tiliäsi vahvistetaan", - "Your account is nearly ready, {username}": "Tilisi on melkein valmis, {username}", + "Your account is nearly ready": "Tilisi on melkein valmis", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Kaupunkisi tai alueesi ja säde käytetään vain ehdottamaan sinulle tapahtumia läheltä. Tapahtuman säde ottaa huomioon alueen hallinnollisen keskustan.", "Your current email is {email}. You use it to log in.": "Nykyinen sähköpostiosoitteesi on {email}. Kirjaudu sisään sillä.", "Your email": "Sähköpostiosoitteesi", diff --git a/src/i18n/fr_FR.json b/src/i18n/fr_FR.json index 1105f217c..10415757c 100644 --- a/src/i18n/fr_FR.json +++ b/src/i18n/fr_FR.json @@ -170,7 +170,7 @@ "Back to user list": "Retour à la liste des utilisateur·ices", "Banner": "Bannière", "Become part of the community and start organizing events": "Faites partie de la communauté et commencez à organiser des événements", - "Before you can login, you need to click on the link inside it to validate your account.": "Avant que vous puissiez vous enregistrer, vous devez cliquer sur le lien à l'intérieur pour valider votre compte.", + "Before you can login, you need to click on the link inside it to validate your account.": "Avant que vous ne puissiez vous connecter, vous devez cliquer sur le lien à l'intérieur pour valider votre compte.", "Begins on": "Commence le", "Best match": "Pertinence", "Big Blue Button": "Big Blue Button", @@ -1494,7 +1494,7 @@ "Your account has been successfully deleted": "Votre compte a été supprimé avec succès", "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 nearly ready, {username}": "Votre compte est presque prêt, {username}", + "Your account is nearly ready": "Votre compte est presque prêt", "Your application code": "Votre code d'application", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Votre ville ou région et le rayon seront uniquement utilisés pour vous suggérer des événements proches. Le rayon des événements proches sera calculé par rapport au centre administratif de la zone.", "Your current email is {email}. You use it to log in.": "Votre adresse e-mail actuelle est {email}. Vous l'utilisez pour vous connecter.", diff --git a/src/i18n/gd.json b/src/i18n/gd.json index 89ab164ac..e1b7f5ef1 100644 --- a/src/i18n/gd.json +++ b/src/i18n/gd.json @@ -1195,7 +1195,7 @@ "Your account has been successfully deleted": "Chaidh an cunntas agad a sguabadh às", "Your account has been validated": "Chaidh an cunntas agad a dhearbhadh", "Your account is being validated": "Tha an cunntas agad ’ga dhearbhadh", - "Your account is nearly ready, {username}": "Cha mhòr nach eil an cunntas gad ullamh, {username}", + "Your account is nearly ready": "Cha mhòr nach eil an cunntas gad ullamh", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Cha dèid am baile no sgìre ’s an t-astar agad a chleachdadh ach airson tachartasan am fagas a mholadh dhut. Bheir astar nan tachartasan an aire air meadhan riaghlaidh na sgìre.", "Your current email is {email}. You use it to log in.": "Is {email} am post-d làithreach agad. Cleachd e airson clàradh a-steach.", "Your email": "Am post-d agad", diff --git a/src/i18n/gl.json b/src/i18n/gl.json index 6c531387d..92102a677 100644 --- a/src/i18n/gl.json +++ b/src/i18n/gl.json @@ -1497,7 +1497,7 @@ "Your account has been successfully deleted": "A túa conta foi eliminada", "Your account has been validated": "A túa conta foi validada", "Your account is being validated": "A túa conta está sendo validada", - "Your account is nearly ready, {username}": "A túa conta xa case está preparada, {username}", + "Your account is nearly ready": "A túa conta xa case está preparada", "Your application code": "O teu código de aplicación", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "A túa cidade ou rexión e o radio só se utilizará para suxerirche eventos próximos. O radio do evento será considerado desde o centro da área administrativa.", "Your current email is {email}. You use it to log in.": "O teu correo é {email}. Utilízao para acceder.", diff --git a/src/i18n/he.json b/src/i18n/he.json index 91ae10d48..b8f1bbe01 100644 --- a/src/i18n/he.json +++ b/src/i18n/he.json @@ -376,5 +376,5 @@ "Your account has been successfully deleted": "החשבון שלך נמחק בהצלחה", "Your account has been validated": "החשבון שלך אומת", "Your account is being validated": "החשבון שלך ממתין לאימות", - "Your account is nearly ready, {username}": "החשבון שלך כמעט מוכן, {username}" + "Your account is nearly ready": "החשבון שלך כמעט מוכן" } diff --git a/src/i18n/hr.json b/src/i18n/hr.json index 0103160fc..0ae1f74d9 100644 --- a/src/i18n/hr.json +++ b/src/i18n/hr.json @@ -1447,7 +1447,7 @@ "Your account has been successfully deleted": "Vaš račun je uspješno izbrisan", "Your account has been validated": "Vaš račun je ovjeren", "Your account is being validated": "Vaš račun se ovjerava", - "Your account is nearly ready, {username}": "Vaš račun je uskoro spreman, {username}", + "Your account is nearly ready": "Vaš račun je uskoro spreman", "Your application code": "Kȏd tvoje aplikacije", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Vaš grad/regija i radius će biti korišteni samo za predlaganje obližnjih događaja. Radiu događaja će razmatrati administrativni centar vašeg mjesta.", "Your current email is {email}. You use it to log in.": "Tvoja aktualna e-mail adresa je {email}. Koristiš je za prijavu.", diff --git a/src/i18n/hu.json b/src/i18n/hu.json index cfe9cd616..bb8ab15ad 100644 --- a/src/i18n/hu.json +++ b/src/i18n/hu.json @@ -1492,7 +1492,7 @@ "Your account has been successfully deleted": "A fiókja sikeresen törölve lett", "Your account has been validated": "A fiókja ellenőrizve lett", "Your account is being validated": "A fiókja ellenőrizés alatt van", - "Your account is nearly ready, {username}": "A fiókja majdnem készen, {username}", + "Your account is nearly ready": "A fiókja majdnem készen", "Your application code": "Az alkalmazáskódja", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "A települése vagy a régiója és a sugár csak a közeli események ajánlásához lesz használva. Az esemény sugara a terület adminisztratív középpontját veszi figyelembe.", "Your current email is {email}. You use it to log in.": "A jelenlegi e-mail-címe {email}. Használja ezt a bejelentkezéshez.", diff --git a/src/i18n/id.json b/src/i18n/id.json index 612fbcadf..715d4d36c 100644 --- a/src/i18n/id.json +++ b/src/i18n/id.json @@ -1128,7 +1128,7 @@ "Your account has been successfully deleted": "Akun Anda berhasil dihapus", "Your account has been validated": "Akun Anda telah divalidasi", "Your account is being validated": "Akun Anda sedang di validasi", - "Your account is nearly ready, {username}": "Akun Anda hampir siap, {username}", + "Your account is nearly ready": "Akun Anda hampir siap", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "Email Anda saat ini adalah {email}. Anda menggunakannya untuk masuk.", "Your email": "Email Anda", diff --git a/src/i18n/it.json b/src/i18n/it.json index 06f44ab08..b32018a4d 100644 --- a/src/i18n/it.json +++ b/src/i18n/it.json @@ -1489,7 +1489,7 @@ "Your account has been successfully deleted": "Il tuo account è stato eliminato con successo", "Your account has been validated": "Il tuo account è stato validato", "Your account is being validated": "Il tuo account è in via di validazione", - "Your account is nearly ready, {username}": "Il tuo account è quasi pronto, {username}", + "Your account is nearly ready": "Il tuo account è quasi pronto", "Your application code": "Il codice della tua applicazione", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "La tua città o regione e il raggio saranno usati solo per suggerirti eventi nelle vicinanze. Il raggio dell'evento considererà il centro amministrativo della zona.", "Your current email is {email}. You use it to log in.": "La tua email attuale è {email}. La usi per accedere.", diff --git a/src/i18n/ja.json b/src/i18n/ja.json index 9c8f205ac..91e2d9c14 100644 --- a/src/i18n/ja.json +++ b/src/i18n/ja.json @@ -1152,7 +1152,7 @@ "Your account has been successfully deleted": "あなたのアカウントの削除に成功しました", "Your account has been validated": "あなたのアカウントは認証されました", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "現在のメールアドレスは{email}です。このアドレスを利用してログインしましょう", "Your email": "メールアドレス", diff --git a/src/i18n/kab.json b/src/i18n/kab.json index d9ee835b2..3ad88ec61 100644 --- a/src/i18n/kab.json +++ b/src/i18n/kab.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "Imayl-ik", diff --git a/src/i18n/kn.json b/src/i18n/kn.json index bd540c6cf..928ca2ea5 100644 --- a/src/i18n/kn.json +++ b/src/i18n/kn.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/nl.json b/src/i18n/nl.json index 0225ecd26..0d9fe72af 100644 --- a/src/i18n/nl.json +++ b/src/i18n/nl.json @@ -1382,7 +1382,7 @@ "Your account has been successfully deleted": "Uw account is succesvol verwijderd", "Your account has been validated": "Uw account is gevalideerd", "Your account is being validated": "Uw account wordt gevalideerd", - "Your account is nearly ready, {username}": "Uw account is bijna klaar, {username}", + "Your account is nearly ready": "Uw account is bijna klaar", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Uw stad of regio en de straal worden alleen gebruikt om u evenementen in de buurt voor te stellen. De straal van het evenement houdt rekening met het administratieve centrum van het gebied.", "Your current email is {email}. You use it to log in.": "Uw huidige e-mail is {email}. Dit gebruikt u om in te loggen.", "Your email": "Uw e-mailadres", diff --git a/src/i18n/nn.json b/src/i18n/nn.json index 5a5062b0a..eced6fb29 100644 --- a/src/i18n/nn.json +++ b/src/i18n/nn.json @@ -1284,7 +1284,7 @@ "Your account has been successfully deleted": "Kontoen din er sletta", "Your account has been validated": "Kontoen din er godkjend", "Your account is being validated": "Kontoen din blir godkjend", - "Your account is nearly ready, {username}": "Kontoen din er snart klar, {username}", + "Your account is nearly ready": "Kontoen din er snart klar", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Byen eller området ditt og radiusen blir berre brukt til å føreslå hendingar i nærleiken. Hendingsradiusen går ut frå administrasjonssenteret i området du har valt.", "Your current email is {email}. You use it to log in.": "Epostadressa du har no, er {email}. Du bruker ho til å logga inn.", "Your email": "Epostadressa di", diff --git a/src/i18n/oc.json b/src/i18n/oc.json index 56e2c7f79..548a2b9da 100644 --- a/src/i18n/oc.json +++ b/src/i18n/oc.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "Lo compte es estat corrèctament suprimit", "Your account has been validated": "Vòstre compte es estat validat", "Your account is being validated": "Vòstre compte es en validacion", - "Your account is nearly ready, {username}": "Vòstre compte es gaireben prèst, {username}", + "Your account is nearly ready": "Vòstre compte es gaireben prèst", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "La vila o la region e lo rai seràn sonque utilizats per vos suggerir d’eveniments prèp. Lo rai dels eveniments prèp serà calculat al respècte al centre administratiu de la zòna.", "Your current email is {email}. You use it to log in.": "Vòstra adreça actuala es {email}. L’utilizatz per vos connectar.", "Your email": "Vòstra adreça electronica", diff --git a/src/i18n/pl.json b/src/i18n/pl.json index 111459bdb..ca5e6a1ca 100644 --- a/src/i18n/pl.json +++ b/src/i18n/pl.json @@ -1478,7 +1478,7 @@ "Your account has been successfully deleted": "Pomyślnie usunięto Twoje konto", "Your account has been validated": "Twoje konto zostało zweryfikowane", "Your account is being validated": "Twoje konto jest w trakcie walidacji", - "Your account is nearly ready, {username}": "Twoje konto jest już prawie gotowe, {username}", + "Your account is nearly ready": "Twoje konto jest już prawie gotowe", "Your application code": "Kod do aplikacji", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Twoje miasto lub region i promień będą używane tylko do sugerowania pobliskich wydarzeń. Promień pobliskich wydarzeń zostanie obliczony w odniesieniu do centrum administracyjnego strefy.", "Your current email is {email}. You use it to log in.": "Twój obecny adres e-mail to {email}. Używasz go, aby się zalogować.", diff --git a/src/i18n/pt.json b/src/i18n/pt.json index 9083bb1ac..e315f2a59 100644 --- a/src/i18n/pt.json +++ b/src/i18n/pt.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "", + "Your account is nearly ready": "", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "", "Your email": "", diff --git a/src/i18n/pt_BR.json b/src/i18n/pt_BR.json index 39422420b..67e9d814b 100644 --- a/src/i18n/pt_BR.json +++ b/src/i18n/pt_BR.json @@ -1492,7 +1492,7 @@ "Your account has been successfully deleted": "Sua conta foi apagada com sucesso", "Your account has been validated": "Sua conta foi validada", "Your account is being validated": "Sua conta esta sendo validada", - "Your account is nearly ready, {username}": "Sua conta está quase pronta, {username}", + "Your account is nearly ready": "Sua conta está quase pronta", "Your application code": "Seu código de aplicação", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Sua cidade ou região e o raio serão usados apenas para sugerir eventos próximos. O raio do evento levará em consideração o centro administrativo da área.", "Your current email is {email}. You use it to log in.": "Seu email atual é {email}. Utilize-o para fazer entrar.", diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 4041b5aa0..ac8328a29 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "Ваша учетная запись была успешно удалена", "Your account has been validated": "Ваша учетная запись была подтверждена", "Your account is being validated": "Ваша учетная запись проверяется", - "Your account is nearly ready, {username}": "Ваш аккаунт почти готов, {username}", + "Your account is nearly ready": "Ваш аккаунт почти готов", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Ваш город, регион или область будут использоваться только для рекомендации вам ближайших мероприятий. Радиус мероприятия считается относительно административного центра области.", "Your current email is {email}. You use it to log in.": "Ваш адрес электронной почты {email}. Вы используете его для входа в систему.", "Your email": "Ваш адрес электронной почты", diff --git a/src/i18n/sl.json b/src/i18n/sl.json index 99cca85b1..9e1a7af89 100644 --- a/src/i18n/sl.json +++ b/src/i18n/sl.json @@ -1117,7 +1117,7 @@ "Your account has been successfully deleted": "Vaš račun je uspešno izbrisan", "Your account has been validated": "Vaš račun je potrjen", "Your account is being validated": "Vaš račun je v procesu potrjevanja", - "Your account is nearly ready, {username}": "Vaš račun je skoraj pripravljen, {username}", + "Your account is nearly ready": "Vaš račun je skoraj pripravljen", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Vaše mesto ali regija in območje bosta uporabljena le za predlaganje dogodkov v bližini. Območje dogodka bo upošteval upravno središče območja.", "Your current email is {email}. You use it to log in.": "Vaš trenutni e-poštni naslov je {email}. Uporabljate ga za prijavo.", "Your email": "Vaša e-pošta", diff --git a/src/i18n/sv.json b/src/i18n/sv.json index c335eaea6..e8652bd1b 100644 --- a/src/i18n/sv.json +++ b/src/i18n/sv.json @@ -1475,7 +1475,7 @@ "Your account has been successfully deleted": "Borttagningen av ditt konto lyckades", "Your account has been validated": "Ditt konto har validerats", "Your account is being validated": "Ditt konto håller på att valideras", - "Your account is nearly ready, {username}": "Ditt konto är nästan redo, {username}", + "Your account is nearly ready": "Ditt konto är nästan redo", "Your application code": "Din applikationskod", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "Din stad eller region och radien kommer endast att användas för att föreslå evenemang i närheten. Evenemangets radie kommer att ta hänsyn till områdets administrativa centrum.", "Your current email is {email}. You use it to log in.": "Din nuvarande e-postadress är {email}. Du använder den för att logga in.", diff --git a/src/i18n/zh_Hans.json b/src/i18n/zh_Hans.json index 440e24228..e24d4ecc4 100644 --- a/src/i18n/zh_Hans.json +++ b/src/i18n/zh_Hans.json @@ -1289,7 +1289,7 @@ "Your account has been successfully deleted": "您的账户已被成功删除", "Your account has been validated": "您的账户已被验证", "Your account is being validated": "您的账户正在验证中", - "Your account is nearly ready, {username}": "您的账户已接近准备就绪,{username}", + "Your account is nearly ready": "您的账户已接近准备就绪", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "你的城市或地区和半径将只用于向你推荐附近的活动。活动半径将从该地区的行政中心算起。", "Your current email is {email}. You use it to log in.": "你目前的电子邮件地址是{email}。你需要用它来登录。", "Your email": "你的电子邮件", diff --git a/src/i18n/zh_Hant.json b/src/i18n/zh_Hant.json index a46f69626..b3e295cf9 100644 --- a/src/i18n/zh_Hant.json +++ b/src/i18n/zh_Hant.json @@ -1153,7 +1153,7 @@ "Your account has been successfully deleted": "", "Your account has been validated": "", "Your account is being validated": "", - "Your account is nearly ready, {username}": "{username},您的帳號就快準備好了", + "Your account is nearly ready": "您的帳號就快準備好了", "Your city or region and the radius will only be used to suggest you events nearby. The event radius will consider the administrative center of the area.": "", "Your current email is {email}. You use it to log in.": "您目前用來登入的電子郵件地址是 {email}。", "Your email": "您的電子郵件地址", diff --git a/src/router/user.ts b/src/router/user.ts index e65590c67..158f8f4d0 100644 --- a/src/router/user.ts +++ b/src/router/user.ts @@ -1,12 +1,11 @@ import { beforeRegisterGuard } from "@/router/guards/register-guard"; -import { RouteLocationNormalized, RouteRecordRaw } from "vue-router"; +import { RouteRecordRaw } from "vue-router"; import { i18n } from "@/utils/i18n"; const t = i18n.global.t; export enum UserRouteName { REGISTER = "Register", - REGISTER_PROFILE = "RegisterProfile", RESEND_CONFIRMATION = "ResendConfirmation", SEND_PASSWORD_RESET = "SendPasswordReset", PASSWORD_RESET = "PasswordReset", @@ -29,20 +28,6 @@ export const userRoutes: RouteRecordRaw[] = [ }, beforeEnter: beforeRegisterGuard, }, - { - path: "/register/profile/:email/:userAlreadyActivated?", - name: UserRouteName.REGISTER_PROFILE, - component: (): Promise => import("@/views/Account/RegisterView.vue"), - // We can only pass string values through params, therefore - props: (route: RouteLocationNormalized): Record => ({ - email: route.params.email, - userAlreadyActivated: route.params.userAlreadyActivated === "true", - }), - meta: { - requiredAuth: false, - announcer: { message: (): string => t("Register") as string }, - }, - }, { path: "/resend-instructions/:email?", name: UserRouteName.RESEND_CONFIRMATION, diff --git a/src/utils/identity.ts b/src/utils/identity.ts index 665e6d070..a341d0ade 100644 --- a/src/utils/identity.ts +++ b/src/utils/identity.ts @@ -43,25 +43,21 @@ export async function initializeCurrentActor( const actorId = localStorage.getItem(AUTH_USER_ACTOR_ID); console.debug("Initializing current actor", actorId); - try { - if (!identities) { - console.debug("Failed to load user's identities", identities); - return; - } + if (!identities) { + console.debug("Failed to load user's identities", identities); + return; + } - if (identities && identities.length < 1) { - console.warn("Logged user has no identities!"); - throw new NoIdentitiesException(); - } - const activeIdentity = - (identities || []).find( - (identity: IPerson | undefined) => identity?.id === actorId - ) || ((identities || [])[0] as IPerson); + if (identities && identities.length < 1) { + console.warn("Logged user has no identities!"); + throw new NoIdentitiesException(); + } + const activeIdentity = + (identities || []).find( + (identity: IPerson | undefined) => identity?.id === actorId + ) || ((identities || [])[0] as IPerson); - if (activeIdentity) { - await changeIdentity(activeIdentity); - } - } catch (e) { - console.error("Failed to initialize current Actor", e); + if (activeIdentity) { + await changeIdentity(activeIdentity); } } diff --git a/src/views/Account/RegisterView.vue b/src/views/Account/RegisterView.vue deleted file mode 100644 index 70a587969..000000000 --- a/src/views/Account/RegisterView.vue +++ /dev/null @@ -1,233 +0,0 @@ - - - diff --git a/src/views/Account/children/EditIdentity.vue b/src/views/Account/children/EditIdentity.vue index 13daa4e12..ee9eb607b 100644 --- a/src/views/Account/children/EditIdentity.vue +++ b/src/views/Account/children/EditIdentity.vue @@ -6,9 +6,13 @@ {{ displayName(identity) }} - {{ t("I create an identity") }} + {{ t("Create a new profile") }} - +
    + {{ t("Congratulations, your account is now created!") }} + {{ t("Now, create your first profile:") }} +
    + - + - +

    + {{ + t( + "This identifier is unique to your profile. It allows others to find you." + ) + }} +

    + +
    - {{ t("Save") }} + {{ t("Create my profile") }}
    @@ -107,7 +110,9 @@

    {{ t( - "These feeds contain event data for the events for which this specific profile is a participant or creator. You should keep these private. You can find feeds for all of your profiles into your notification settings." + "These feeds contain event data for the events for which this specific profile is a participant or creator." + + "You should keep these private." + + " You can find feeds for all of your profiles into your notification settings." ) }}

    @@ -214,7 +219,10 @@ import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core"; import pick from "lodash/pick"; import { ActorType } from "@/types/enums"; import { useRouter } from "vue-router"; -import { useCurrentActorClient } from "@/composition/apollo/actor"; +import { + useCurrentActorClient, + useCurrentUserIdentities, +} from "@/composition/apollo/actor"; import { useMutation, useQuery, useApolloClient } from "@vue/apollo-composable"; import { useAvatarMaxSize } from "@/composition/config"; import { computed, inject, reactive, ref, watch } from "vue"; @@ -233,6 +241,8 @@ const props = defineProps<{ isUpdate: boolean; identityName?: string }>(); const { currentActor } = useCurrentActorClient(); +const { identities } = useCurrentUserIdentities(); + const { result: personResult, onError: onPersonError, @@ -459,13 +469,22 @@ const { }, })); -createIdentityDone(() => { +createIdentityDone(async () => { notifier?.success( t("Identity {displayName} created", { displayName: displayName(identity.value), }) ); + // If it is the fisrt created identity, then we need to activate this identity + const client = resolveClient(); + const data = client.readQuery<{ + loggedUser: Pick; + }>({ query: IDENTITIES }); + if (data) { + await maybeUpdateCurrentActorCache(data.loggedUser.actors[0]); + } + router.push({ name: RouteName.UPDATE_IDENTITY, params: { identityName: identity.value.preferredUsername }, @@ -687,8 +706,11 @@ const redirectIfNoIdentitySelected = async (identityParam?: string) => { const maybeUpdateCurrentActorCache = async (newIdentity: IPerson) => { if (currentActor.value) { + // If there is no current actor, update the current actor if ( - currentActor.value.preferredUsername === identity.value.preferredUsername + currentActor.value.preferredUsername === + identity.value.preferredUsername || + currentActor.value.id == null ) { await changeIdentity(newIdentity); } diff --git a/src/views/User/LoginView.vue b/src/views/User/LoginView.vue index 72e12faad..ed28a10ec 100644 --- a/src/views/User/LoginView.vue +++ b/src/views/User/LoginView.vue @@ -268,11 +268,7 @@ const loginAction = async (e: Event) => { if (err instanceof NoIdentitiesException && currentUser.value) { console.debug("No identities, redirecting to profile registration"); await router.push({ - name: RouteName.REGISTER_PROFILE, - params: { - email: currentUser.value.email, - userAlreadyActivated: "true", - }, + name: RouteName.CREATE_IDENTITY, }); } else { console.error(err); diff --git a/src/views/User/ProviderValidation.vue b/src/views/User/ProviderValidation.vue index af21112bc..bd22e4df2 100644 --- a/src/views/User/ProviderValidation.vue +++ b/src/views/User/ProviderValidation.vue @@ -50,7 +50,7 @@ onUpdateCurrentUserClientDone(async () => { await changeIdentity(loggedUser.defaultActor); await router.push({ name: RouteName.HOME }); } else { - // No need to push to REGISTER_PROFILE, the navbar will do it for us + // No need to push to CREATE_IDENTITY, the navbar will do it for us } } catch (e) { console.error(e); diff --git a/src/views/User/RegisterView.vue b/src/views/User/RegisterView.vue index 935e9ba2a..9429e84e8 100644 --- a/src/views/User/RegisterView.vue +++ b/src/views/User/RegisterView.vue @@ -84,7 +84,7 @@
  • -
    +
    {{ t("Registrations are restricted by allowlisting.") }} @@ -199,6 +199,29 @@
    +
    +

    + {{ t("Your account is nearly ready") }} +

    + + + +

    + {{ + t( + "Before you can login, you need to click on the link inside it to validate your account." + ) + }} +

    + {{ t("Back to homepage") }} +
    @@ -212,7 +235,7 @@ import AuthProviders from "../../components/User/AuthProviders.vue"; import { computed, reactive, ref, watch } from "vue"; import { useMutation, useQuery } from "@vue/apollo-composable"; import { useI18n } from "vue-i18n"; -import { useRoute, useRouter } from "vue-router"; +import { useRoute } from "vue-router"; import { useHead } from "@/utils/head"; import { AbsintheGraphQLErrors } from "@/types/errors.model"; @@ -222,7 +245,7 @@ type credentialsType = { email: string; password: string; locale: string }; const { t, locale } = useI18n({ useScope: "global" }); const route = useRoute(); -const router = useRouter(); +const validationSent = ref(false); const { result: configResult } = useQuery<{ config: IConfig }>(CONFIG); @@ -256,10 +279,7 @@ useHead({ const { onDone, onError, mutate } = useMutation(CREATE_USER); onDone(() => { - router.push({ - name: RouteName.REGISTER_PROFILE, - params: { email: credentials.email }, - }); + validationSent.value = true; }); onError((error) => { diff --git a/src/views/User/ValidateUser.vue b/src/views/User/ValidateUser.vue index 1ef969023..4eeafe76d 100644 --- a/src/views/User/ValidateUser.vue +++ b/src/views/User/ValidateUser.vue @@ -72,8 +72,7 @@ onUpdatingCurrentUserClientDone(async () => { } else { // If the user didn't register any profile yet, let's create one for them await router.push({ - name: RouteName.REGISTER_PROFILE, - params: { email: user.value?.email, userAlreadyActivated: "true" }, + name: RouteName.CREATE_IDENTITY, }); } }); diff --git a/test/graphql/resolvers/user_test.exs b/test/graphql/resolvers/user_test.exs index 0267bd553..5860403cf 100644 --- a/test/graphql/resolvers/user_test.exs +++ b/test/graphql/resolvers/user_test.exs @@ -73,24 +73,6 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do } """ - @register_person_mutation """ - mutation RegisterPerson($preferredUsername: String!, $name: String, $summary: String, $email: String!) { - registerPerson( - preferredUsername: $preferredUsername, - name: $name, - summary: $summary, - email: $email, - ) { - preferredUsername, - name, - summary, - avatar { - url - }, - } - } - """ - @change_email_mutation """ mutation ChangeEmail($email: String!, $password: String!) { changeEmail(email: $email, password: $password) { @@ -382,7 +364,7 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do password: "long password" } - test "test create_user/3 creates an user and register_person/3 registers a profile", + test "test create_user/3 creates an user", %{conn: conn} do res = conn @@ -397,16 +379,6 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do {:ok, user} = Users.get_user_by_email(@user_creation.email) assert_email_sent(to: user.email) - - res = - conn - |> AbsintheHelpers.graphql_query( - query: @register_person_mutation, - variables: @user_creation - ) - - assert res["data"]["registerPerson"]["preferredUsername"] == - @user_creation.preferredUsername end test "create_user/3 doesn't allow two users with the same email", %{conn: conn} do @@ -574,81 +546,6 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do assert res["data"]["createUser"]["email"] == "test+alias@demo.tld" end - test "register_person/3 doesn't register a profile from an unknown email", %{conn: conn} do - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @create_user_mutation, - variables: @user_creation - ) - - res = - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @register_person_mutation, - variables: Map.put(@user_creation, :email, "random") - ) - - assert hd(res["errors"])["message"] == - "Aucun·e utilisateur·ice avec cette adresse e-mail n'a été trouvé·e" - end - - test "register_person/3 can't be called with an existing profile", %{conn: conn} do - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @create_user_mutation, - variables: @user_creation - ) - - res = - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @register_person_mutation, - variables: @user_creation - ) - - assert res["data"]["registerPerson"]["preferredUsername"] == - @user_creation.preferredUsername - - res = - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @register_person_mutation, - variables: @user_creation - ) - - assert hd(res["errors"])["message"] == - "Vous avez déjà un profil pour cet utilisateur" - end - - test "register_person/3 is case insensitive", %{conn: conn} do - insert(:actor, preferred_username: "myactor") - - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @create_user_mutation, - variables: @user_creation - ) - - res = - conn - |> put_req_header("accept-language", "fr") - |> AbsintheHelpers.graphql_query( - query: @register_person_mutation, - variables: Map.put(@user_creation, :preferredUsername, "Myactor") - ) - - refute is_nil(res["errors"]) - - assert hd(res["errors"])["message"] == - ["Cet identifiant est déjà pris."] - end - test "test create_user/3 doesn't create an user with bad email", %{conn: conn} do res = conn