mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 00:06:21 +00:00
Merge branch 'issue-2123' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
commit
af53d59e53
3 changed files with 12 additions and 7 deletions
|
@ -83,16 +83,19 @@ class UsuariesController < ApplicationController
|
|||
# Enviar la invitación si es necesario y agregar al sitio
|
||||
invitaciones.each do |invitacion|
|
||||
attributes = { email: invitacion.address }
|
||||
options = { skip_invitation: true }
|
||||
|
||||
next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes)
|
||||
|
||||
usuarie = Usuarie.find_by attributes.tap do |u|
|
||||
u.send_devise_notification(:invitation_instructions, nil)
|
||||
usuarie = Usuarie.find_by attributes
|
||||
usuarie ||= Usuarie.invite!(attributes, nil, options).tap do |u|
|
||||
u.generate_invitation_token!
|
||||
end
|
||||
|
||||
usuarie ||= Usuarie.invite! attributes
|
||||
|
||||
@site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as)
|
||||
|
||||
# XXX: La invitación tiene que ser enviada luego de crear el rol
|
||||
usuarie.send(:send_devise_notification, :invitation_instructions, nil)
|
||||
end
|
||||
|
||||
redirect_to site_usuaries_path(@site)
|
||||
|
|
|
@ -19,4 +19,6 @@
|
|||
- else
|
||||
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url(change_locale_to: @resource.lang)
|
||||
|
||||
%p= t('devise.mailer.invitation_instructions.ignore')
|
||||
%p= t('devise.mailer.invitation_instructions.ignore')
|
||||
- else
|
||||
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
= t('devise.mailer.invitation_instructions.accept_until',
|
||||
due_date: l(@resource.invitation_due_at,
|
||||
format: :'devise.mailer.invitation_instructions.accept_until_format'))
|
||||
\
|
||||
= t('devise.mailer.invitation_instructions.ignore')
|
||||
- else
|
||||
= root_url(change_locale_to: @resource.lang)
|
||||
= t('devise.mailer.invitation_instructions.sign_in')
|
||||
\
|
||||
= t('devise.mailer.invitation_instructions.ignore')
|
||||
|
|
Loading…
Reference in a new issue