decidim-direct_verifications 0.17.8 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -2
- data/app/assets/config/direct_verifications_admin_manifest.css +3 -0
- data/app/assets/stylesheets/decidim/direct_verifications/authorizations.scss +17 -0
- data/app/commands/decidim/direct_verifications/verification/create_import.rb +50 -0
- data/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb +40 -0
- data/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +71 -46
- data/app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb +55 -0
- data/app/forms/decidim/direct_verifications/registration_form.rb +8 -0
- data/app/forms/decidim/direct_verifications/verification/create_import_form.rb +43 -0
- data/app/jobs/decidim/direct_verifications/authorize_users_job.rb +34 -0
- data/app/jobs/decidim/direct_verifications/base_import_job.rb +38 -0
- data/app/jobs/decidim/direct_verifications/register_users_job.rb +19 -0
- data/app/jobs/decidim/direct_verifications/revoke_users_job.rb +17 -0
- data/app/mailers/decidim/direct_verifications/import_mailer.rb +27 -0
- data/app/mailers/decidim/direct_verifications/stats.rb +23 -0
- data/app/views/decidim/direct_verifications/import_mailer/finished_processing.html.erb +7 -0
- data/app/views/decidim/direct_verifications/import_mailer/finished_processing.text.erb +7 -0
- data/app/views/decidim/direct_verifications/verification/admin/authorizations/index.html.erb +42 -0
- data/app/views/decidim/direct_verifications/verification/admin/direct_verifications/index.html.erb +18 -17
- data/app/views/decidim/direct_verifications/verification/admin/imports/new.html.erb +50 -0
- data/app/views/decidim/direct_verifications/verification/admin/stats/index.html.erb +3 -3
- data/config/initializers/mail_previews.rb +5 -0
- data/config/locales/ca.yml +25 -20
- data/config/locales/cs.yml +69 -0
- data/config/locales/en.yml +34 -2
- data/config/locales/es.yml +25 -20
- data/config/locales/fr.yml +69 -0
- data/lib/decidim/direct_verifications.rb +24 -1
- data/lib/decidim/direct_verifications/authorize_user.rb +64 -0
- data/lib/decidim/direct_verifications/instrumenter.rb +58 -0
- data/lib/decidim/direct_verifications/parsers.rb +11 -0
- data/lib/decidim/direct_verifications/parsers/base_parser.rb +37 -0
- data/lib/decidim/direct_verifications/parsers/metadata_parser.rb +54 -0
- data/lib/decidim/direct_verifications/parsers/name_parser.rb +40 -0
- data/lib/decidim/direct_verifications/register_user.rb +54 -0
- data/lib/decidim/direct_verifications/revoke_user.rb +45 -0
- data/lib/decidim/direct_verifications/tests/factories.rb +11 -0
- data/lib/decidim/direct_verifications/tests/verification_controller_examples.rb +83 -0
- data/lib/decidim/direct_verifications/user_processor.rb +18 -98
- data/lib/decidim/direct_verifications/user_stats.rb +9 -6
- data/lib/decidim/direct_verifications/verification/admin_engine.rb +6 -1
- data/lib/decidim/direct_verifications/version.rb +3 -2
- metadata +38 -9
- data/lib/decidim/direct_verifications/config.rb +0 -23
@@ -0,0 +1,69 @@
|
|
1
|
+
cs:
|
2
|
+
decidim:
|
3
|
+
admin:
|
4
|
+
models:
|
5
|
+
user:
|
6
|
+
fields:
|
7
|
+
roles:
|
8
|
+
participant: Účastník
|
9
|
+
authorization_handlers:
|
10
|
+
admin:
|
11
|
+
direct_verifications:
|
12
|
+
help:
|
13
|
+
- 'Umožňuje masivní zavedení uživatelů:'
|
14
|
+
- Přímá registrace v organizaci a odeslání pozvánek
|
15
|
+
- Ověřit je pomocí jakékoliv metody aktivního ověření
|
16
|
+
- Zrušit jejich ověření pomocí jakékoli metody aktivního ověření
|
17
|
+
direct_verifications:
|
18
|
+
explanation: Ruční ověření správcem organizace
|
19
|
+
name: Přímé ověření
|
20
|
+
direct_verifications:
|
21
|
+
verification:
|
22
|
+
admin:
|
23
|
+
authorizations:
|
24
|
+
index:
|
25
|
+
created_at: Vytvořeno v
|
26
|
+
metadata: Metadata
|
27
|
+
name: Název
|
28
|
+
title: Autorizace
|
29
|
+
user_name: Uživatelské jméno
|
30
|
+
new_import: Nový import
|
31
|
+
direct_verifications:
|
32
|
+
create:
|
33
|
+
authorized: "%{authorized} uživatelů bylo úspěšně ověřeno pomocí [%{handler}] (%{count} detekováno, %{errors} chyb)"
|
34
|
+
info: "Zjištěno %{count} uživatelů, z nichž %{registered} jsou registrováni, %{authorized} autorizováni pomocí [%{handler}] (%{unconfirmed} nepotvrzeno)"
|
35
|
+
registered: "%{registered} uživatelů bylo úspěšně zaregistrováno (%{count} detekováno, %{errors} chyb) "
|
36
|
+
revoked: Ověření od %{revoked} uživatelů bylo zrušeno pomocí [%{handler}] (%{count} detekováno, %{errors} chyb)
|
37
|
+
gdpr_disclaimer: Udělejte to v rámci vaší odpovědnosti. Nezapomeňte, že potřebujete mít výslovný souhlas svých uživatelů, abyste je mohli zaregistrovat. V opačném případě můžete porušovat nařízení o GDPR v zemích EU.
|
38
|
+
index:
|
39
|
+
authorizations: Autorizovaní uživatelé
|
40
|
+
stats: Statistiky uživatelů
|
41
|
+
title: Registrovat a autorizovat uživatele
|
42
|
+
new:
|
43
|
+
authorization_handler: Ověřovací metoda
|
44
|
+
authorize: Autorizovat uživatele
|
45
|
+
check: Zkontrolovat stav uživatelů
|
46
|
+
info: Zadejte e-maily zde, jeden na řádek. Pokud e-mailům předchází text, bude interpretován jako jméno uživatele
|
47
|
+
register: Registrovat uživatele na platformě (pokud existují, budou ignorováni)
|
48
|
+
revoke: Zrušit autorizaci od uživatelů
|
49
|
+
submit: Odeslat a zpracovat seznam
|
50
|
+
textarea: Seznam e-mailů
|
51
|
+
stats:
|
52
|
+
index:
|
53
|
+
authorized: Autorizováno
|
54
|
+
authorized_unconfirmed: Autorizováno, ale nepotvrzeno
|
55
|
+
global: "- Jakákoli metoda ověřování -"
|
56
|
+
registered: Registrován
|
57
|
+
unconfirmed: Nepotvrzeno
|
58
|
+
authorizations:
|
59
|
+
new:
|
60
|
+
no_action: Tato metoda vyžaduje administrátora, který vás ověřuje
|
61
|
+
verifications:
|
62
|
+
authorizations:
|
63
|
+
first_login:
|
64
|
+
actions:
|
65
|
+
direct_verifications: Přímé ověření
|
66
|
+
devise:
|
67
|
+
mailer:
|
68
|
+
direct_invite:
|
69
|
+
subject: Pokyny pro pozvání
|
data/config/locales/en.yml
CHANGED
@@ -21,12 +21,39 @@ en:
|
|
21
21
|
direct_verifications:
|
22
22
|
verification:
|
23
23
|
admin:
|
24
|
+
imports:
|
25
|
+
new:
|
26
|
+
info: Import a CSV file with a user entry per line copying the format from the example below
|
27
|
+
submit: Upload file
|
28
|
+
file: CSV file with users data
|
29
|
+
create:
|
30
|
+
success: File successfully uploaded. We'll email you when all users are imported.
|
31
|
+
error: There was an error importing the file
|
32
|
+
mailer:
|
33
|
+
subject: File import results
|
34
|
+
authorized: "%{successful} users have been successfully verified using
|
35
|
+
[%{handler}] (%{count} detected, %{errors} errors)"
|
36
|
+
info: "%{count} users detected, of which %{registered} are registered,
|
37
|
+
%{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
|
38
|
+
registered: "%{successful} users have been successfully registered (%{count}
|
39
|
+
detected, %{errors} errors) "
|
40
|
+
revoked: Verification from %{successful} users have been revoked using
|
41
|
+
[%{handler}] (%{count} detected, %{errors} errors)
|
42
|
+
authorizations:
|
43
|
+
index:
|
44
|
+
created_at: Created at
|
45
|
+
metadata: Metadata
|
46
|
+
name: Name
|
47
|
+
title: Authorizations
|
48
|
+
user_name: User name
|
49
|
+
new_import: New import
|
24
50
|
direct_verifications:
|
25
51
|
create:
|
26
52
|
authorized: "%{authorized} users have been successfully verified using
|
27
53
|
[%{handler}] (%{count} detected, %{errors} errors)"
|
28
54
|
info: "%{count} users detected, of which %{registered} are registered,
|
29
55
|
%{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
|
56
|
+
missing_header: Please, provide a header row
|
30
57
|
registered: "%{registered} users have been successfully registered (%{count}
|
31
58
|
detected, %{errors} errors) "
|
32
59
|
revoked: Verification from %{revoked} users have been revoked using
|
@@ -35,14 +62,14 @@ en:
|
|
35
62
|
need to have explicit consent from your users in order to register them.
|
36
63
|
Otherwise you will be infringing the GDPR regulation in EU countries.
|
37
64
|
index:
|
65
|
+
authorizations: Authorized users
|
38
66
|
stats: User stats
|
39
67
|
title: Register and authorize users
|
40
68
|
new:
|
41
69
|
authorization_handler: Verification method
|
42
70
|
authorize: Authorize users
|
43
71
|
check: Check users status
|
44
|
-
|
45
|
-
by a text, it will be interpreted as the user's name
|
72
|
+
info_html: You can <a href=%{link}>import a CSV</a> or enter the emails here, one per line. If the emails are preceded by a text, it will be interpreted as the user's name.
|
46
73
|
register: Register users in the platform (if they exist they will be ignored)
|
47
74
|
revoke: Revoke authorization from users
|
48
75
|
submit: Send and process the list
|
@@ -57,6 +84,11 @@ en:
|
|
57
84
|
authorizations:
|
58
85
|
new:
|
59
86
|
no_action: This method requires an administrator that verifies you
|
87
|
+
verifications:
|
88
|
+
authorizations:
|
89
|
+
first_login:
|
90
|
+
actions:
|
91
|
+
direct_verifications: Direct verification
|
60
92
|
devise:
|
61
93
|
mailer:
|
62
94
|
direct_invite:
|
data/config/locales/es.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
---
|
2
1
|
es:
|
3
2
|
decidim:
|
4
3
|
admin:
|
@@ -11,40 +10,41 @@ es:
|
|
11
10
|
admin:
|
12
11
|
direct_verifications:
|
13
12
|
help:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
- 'Permite la introducción masiva d usuarios con el fin de:'
|
14
|
+
- Registrarlos directamente a la organización con el envío de invitaciones
|
15
|
+
- Verificarlos en cualquier método de verificación activo
|
16
|
+
- Revocar la verificación en cualquier método de verificación activo
|
18
17
|
direct_verifications:
|
19
18
|
explanation: Verificación manual por parte de los administradores de la organización
|
20
19
|
name: Verificación directa
|
21
20
|
direct_verifications:
|
22
21
|
verification:
|
23
22
|
admin:
|
23
|
+
authorizations:
|
24
|
+
index:
|
25
|
+
created_at: Creado el
|
26
|
+
metadata: Metadatos
|
27
|
+
name: Nombre
|
28
|
+
title: Autorizaciones
|
29
|
+
user_name: Nombre de usuario
|
30
|
+
new_import: Nueva importación
|
24
31
|
direct_verifications:
|
25
32
|
create:
|
26
|
-
authorized: Se han verificado correctamente %{authorized} usuarios usando
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
detectados, %{errors} errores)
|
33
|
-
revoked: Se ha revocado correctament la verificación de %{revoked} usuarios
|
34
|
-
usando [%{handler}] (%{count} detectados, %{errors} errores)
|
35
|
-
gdpr_disclaimer: Haga esto bajo su responsabilidad. Recuerde que debe
|
36
|
-
contar con el consentimiento explícito de sus usuarios para poder registrarlos.
|
37
|
-
De lo contrario, estará infringiendo la regulación GDPR en los países
|
38
|
-
de la UE.
|
33
|
+
authorized: "Se han verificado correctamente %{authorized} usuarios usando [%{handler}] (%{count} detectados, %{errors} errores)"
|
34
|
+
info: "Se han detectado %{count} usuarios, de los cuales %{registered} están registrados, %{authorized} autorizados usando [%{handler}] (%{unconfirmed} sin confirmar)"
|
35
|
+
missing_header: Por favor, proporcionad una fila de encabezamiento
|
36
|
+
registered: "Se han registrado correctamente %{registered} usuarios (%{count} detectados, %{errors} errores)"
|
37
|
+
revoked: Se ha revocado correctament la verificación de %{revoked} usuarios usando [%{handler}] (%{count} detectados, %{errors} errores)
|
38
|
+
gdpr_disclaimer: Haga esto bajo su responsabilidad. Recuerde que debe contar con el consentimiento explícito de sus usuarios para poder registrarlos. De lo contrario, estará infringiendo la regulación GDPR en los países de la UE.
|
39
39
|
index:
|
40
|
+
authorizations: Usuarios autorizados
|
40
41
|
stats: Estadísticas de usuarios
|
41
42
|
title: Inscribe y autoriza usuarios
|
42
43
|
new:
|
43
44
|
authorization_handler: Método de verificación
|
44
45
|
authorize: Autoriza los usuarios
|
45
46
|
check: Comprueba el estado de los usuarios
|
46
|
-
info: Introduce aquí los emails, uno por linea. Si los emails están precedidos
|
47
|
-
por un texto, se interpretará como el nombre del usuario
|
47
|
+
info: Introduce aquí los emails, uno por linea. Si los emails están precedidos por un texto, se interpretará como el nombre del usuario
|
48
48
|
register: Registra los usuarios a la plataforma (si existen se ignorarán)
|
49
49
|
revoke: Revoca la autorización de los usuarios
|
50
50
|
submit: Envía y procesa el listado
|
@@ -59,6 +59,11 @@ es:
|
|
59
59
|
authorizations:
|
60
60
|
new:
|
61
61
|
no_action: Este método requiere que un administrador os verifique
|
62
|
+
verifications:
|
63
|
+
authorizations:
|
64
|
+
first_login:
|
65
|
+
actions:
|
66
|
+
direct_verifications: Verificación directa
|
62
67
|
devise:
|
63
68
|
mailer:
|
64
69
|
direct_invite:
|
@@ -0,0 +1,69 @@
|
|
1
|
+
fr:
|
2
|
+
decidim:
|
3
|
+
admin:
|
4
|
+
models:
|
5
|
+
user:
|
6
|
+
fields:
|
7
|
+
roles:
|
8
|
+
participant: Participant
|
9
|
+
authorization_handlers:
|
10
|
+
admin:
|
11
|
+
direct_verifications:
|
12
|
+
help:
|
13
|
+
- 'Permet l''introduction massive des utilisateurs afin de :'
|
14
|
+
- Inscription directe au sein de l'organisation et envoie des invitations
|
15
|
+
- Vérifiez-les avec n'importe quelle méthode de vérification active
|
16
|
+
- Révoquer leur vérification dans toute méthode de vérification active
|
17
|
+
direct_verifications:
|
18
|
+
explanation: Vérification manuelle par les administrateurs de l'organisation
|
19
|
+
name: Vérification directe
|
20
|
+
direct_verifications:
|
21
|
+
verification:
|
22
|
+
admin:
|
23
|
+
authorizations:
|
24
|
+
index:
|
25
|
+
created_at: Créé à
|
26
|
+
metadata: Métadonnées
|
27
|
+
name: Nom
|
28
|
+
title: Autorisations
|
29
|
+
user_name: Nom de l'utilisateur
|
30
|
+
new_import: Nouvel import
|
31
|
+
direct_verifications:
|
32
|
+
create:
|
33
|
+
authorized: "%{authorized} utilisateurs ont été vérifiés avec succès en utilisant [%{handler}] (%{count} détectés, %{errors} erreurs)"
|
34
|
+
info: "%{count} utilisateurs détectés, dont %{registered} sont enregistrés, %{authorized} autorisés à utiliser [%{handler}] (%{unconfirmed} non confirmés)"
|
35
|
+
registered: "%{registered} utilisateurs ont été enregistrés avec succès (%{count} détectés, %{errors} erreurs) "
|
36
|
+
revoked: La vérification de %{revoked} utilisateurs ont été révoqués en utilisant [%{handler}] (%{count} détectés, %{errors} erreurs)
|
37
|
+
gdpr_disclaimer: Faites-le sous votre responsabilité. N'oubliez pas que vous devez avoir le consentement explicite de vos utilisateurs afin de les enregistrer. Dans le cas contraire, vous enfreindrez le règlement du RGPD dans les pays de l'UE.
|
38
|
+
index:
|
39
|
+
authorizations: Utilisateurs autorisés
|
40
|
+
stats: Statistiques des utilisateurs
|
41
|
+
title: Inscription et autorisation des utilisateurs
|
42
|
+
new:
|
43
|
+
authorization_handler: Méthode de vérification
|
44
|
+
authorize: Utilisateurs autorisés
|
45
|
+
check: Vérifier le statut des utilisateurs
|
46
|
+
info: Entrez les e-mails ici, un par ligne. Si les e-mails sont précédés d'un texte, il sera interprété comme le nom de l'utilisateur
|
47
|
+
register: Inscrire des utilisateurs sur la plateforme (si ils existent, ils seront ignorés)
|
48
|
+
revoke: Révoquer l'autorisation des utilisateurs
|
49
|
+
submit: Envoyer et traiter la liste
|
50
|
+
textarea: Liste d'emails
|
51
|
+
stats:
|
52
|
+
index:
|
53
|
+
authorized: Autorisé
|
54
|
+
authorized_unconfirmed: Autorisé mais non confirmé
|
55
|
+
global: "- N'importe quelle méthode de vérification -"
|
56
|
+
registered: Inscrits
|
57
|
+
unconfirmed: Non confirmé
|
58
|
+
authorizations:
|
59
|
+
new:
|
60
|
+
no_action: Cette méthode nécessite un administrateur qui vous vérifie
|
61
|
+
verifications:
|
62
|
+
authorizations:
|
63
|
+
first_login:
|
64
|
+
actions:
|
65
|
+
direct_verifications: Vérification directe
|
66
|
+
devise:
|
67
|
+
mailer:
|
68
|
+
direct_invite:
|
69
|
+
subject: Instructions d'invitation
|
@@ -1,12 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "direct_verifications/version"
|
4
|
-
require_relative "direct_verifications/config"
|
5
4
|
require_relative "direct_verifications/user_processor"
|
6
5
|
require_relative "direct_verifications/user_stats"
|
7
6
|
require_relative "direct_verifications/verification"
|
7
|
+
require_relative "direct_verifications/parsers"
|
8
8
|
|
9
9
|
module Decidim
|
10
10
|
module DirectVerifications
|
11
|
+
include ActiveSupport::Configurable
|
12
|
+
|
13
|
+
class InputParserError < StandardError; end
|
14
|
+
|
15
|
+
# Specify in this variable which authorization methods can be managed by the plugin
|
16
|
+
# Be careful to specify only what you really need
|
17
|
+
config_accessor :manage_workflows do
|
18
|
+
["direct_verifications"]
|
19
|
+
end
|
20
|
+
|
21
|
+
# The processor for the user uploaded data where to extract emails and other info
|
22
|
+
# be default it uses Decidim::DirectVerifications::Parsers::NameParser
|
23
|
+
# Currently available are:
|
24
|
+
# - :name_parser
|
25
|
+
# - :metadata_parser
|
26
|
+
# A custom parser can be specified as long it respects the module hierachy
|
27
|
+
config_accessor :input_parser do
|
28
|
+
:name_parser
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.find_parser_class(manifest)
|
32
|
+
"Decidim::DirectVerifications::Parsers::#{manifest.to_s.camelize}".safe_constantize || Decidim::DirectVerifications::Parsers::NameParser
|
33
|
+
end
|
11
34
|
end
|
12
35
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DirectVerifications
|
5
|
+
class AuthorizeUser
|
6
|
+
# rubocop:disable Metrics/ParameterLists
|
7
|
+
def initialize(email, data, session, organization, instrumenter, authorization_handler)
|
8
|
+
@email = email
|
9
|
+
@data = data
|
10
|
+
@session = session
|
11
|
+
@organization = organization
|
12
|
+
@instrumenter = instrumenter
|
13
|
+
@authorization_handler = authorization_handler
|
14
|
+
end
|
15
|
+
# rubocop:enable Metrics/ParameterLists
|
16
|
+
|
17
|
+
def call
|
18
|
+
unless user
|
19
|
+
instrumenter.add_error :authorized, email
|
20
|
+
return
|
21
|
+
end
|
22
|
+
|
23
|
+
return unless valid_authorization?
|
24
|
+
|
25
|
+
Verification::ConfirmUserAuthorization.call(authorization, form, session) do
|
26
|
+
on(:ok) do
|
27
|
+
instrumenter.add_processed :authorized, email
|
28
|
+
end
|
29
|
+
on(:invalid) do
|
30
|
+
instrumenter.add_error :authorized, email
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :email, :data, :session, :organization, :instrumenter, :authorization_handler
|
38
|
+
|
39
|
+
def valid_authorization?
|
40
|
+
!authorization.granted? || authorization.expired?
|
41
|
+
end
|
42
|
+
|
43
|
+
def user
|
44
|
+
@user ||= User.find_by(email: email, decidim_organization_id: organization.id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def authorization
|
48
|
+
@authorization ||=
|
49
|
+
begin
|
50
|
+
auth = Authorization.find_or_initialize_by(
|
51
|
+
user: user,
|
52
|
+
name: authorization_handler
|
53
|
+
)
|
54
|
+
auth.metadata = data
|
55
|
+
auth
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def form
|
60
|
+
Verification::DirectVerificationsForm.new(email: user.email, name: user.name)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DirectVerifications
|
5
|
+
class Instrumenter
|
6
|
+
def initialize(current_user)
|
7
|
+
@current_user = current_user
|
8
|
+
@errors = { registered: Set.new, authorized: Set.new, revoked: Set.new }
|
9
|
+
@processed = { registered: Set.new, authorized: Set.new, revoked: Set.new }
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_processed(type, email)
|
13
|
+
@processed[type] << email
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_error(type, email)
|
17
|
+
@errors[type] << email
|
18
|
+
end
|
19
|
+
|
20
|
+
def processed_count(key)
|
21
|
+
processed[key].size
|
22
|
+
end
|
23
|
+
|
24
|
+
def errors_count(key)
|
25
|
+
errors[key].size
|
26
|
+
end
|
27
|
+
|
28
|
+
def emails_count(key)
|
29
|
+
@processed[key].size + @errors[key].size
|
30
|
+
end
|
31
|
+
|
32
|
+
def track(event, email, user = nil)
|
33
|
+
if user
|
34
|
+
add_processed event, email
|
35
|
+
log_action user
|
36
|
+
else
|
37
|
+
add_error event, email
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
attr_reader :current_user, :processed, :errors
|
44
|
+
|
45
|
+
def log_action(user)
|
46
|
+
Decidim.traceability.perform_action!(
|
47
|
+
"invite",
|
48
|
+
user,
|
49
|
+
current_user,
|
50
|
+
extra: {
|
51
|
+
invited_user_role: "participant",
|
52
|
+
invited_user_id: user.id
|
53
|
+
}
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|