Move exchanging of XMPP contacts to account confirmation
Since the ejabberd service is now being enabled after the confirmation, we also need to move the exchanging of roster contacts to that point.
This commit is contained in:
@@ -53,7 +53,14 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def devise_after_confirmation
|
||||
enable_service %w[discourse gitea mediawiki ejabberd]
|
||||
enable_service %w[ discourse ejabberd gitea mediawiki ]
|
||||
|
||||
#TODO enable in development when we have easy setup of ejabberd etc.
|
||||
return if Rails.env.development?
|
||||
|
||||
if inviter.present?
|
||||
exchange_xmpp_contact_with_inviter if Setting.ejabberd_enabled?
|
||||
end
|
||||
end
|
||||
|
||||
def reset_password(new_password, new_password_confirmation)
|
||||
@@ -120,6 +127,12 @@ class User < ApplicationRecord
|
||||
ldap.delete_attribute(dn,:service)
|
||||
end
|
||||
|
||||
def exchange_xmpp_contact_with_inviter
|
||||
return unless inviter.services_enabled.include?("ejabberd") &&
|
||||
services_enabled.include?("ejabberd")
|
||||
XmppExchangeContactsJob.perform_later(inviter, self.cn, self.ou)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ldap
|
||||
|
||||
@@ -15,7 +15,6 @@ class CreateAccount < ApplicationService
|
||||
|
||||
if @invitation.present?
|
||||
update_invitation(user.id)
|
||||
exchange_xmpp_contacts if Setting.ejabberd_enabled
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,12 +42,6 @@ class CreateAccount < ApplicationService
|
||||
CreateLdapUserJob.perform_later(@username, @domain, @email, hashed_pw)
|
||||
end
|
||||
|
||||
def exchange_xmpp_contacts
|
||||
#TODO enable in development when we have easy setup of ejabberd etc.
|
||||
return if Rails.env.development?
|
||||
XmppExchangeContactsJob.perform_later(@invitation.user, @username, @domain)
|
||||
end
|
||||
|
||||
def create_lndhub_account(user)
|
||||
#TODO enable in development when we have a local lndhub (mock?) API
|
||||
return if Rails.env.development?
|
||||
|
||||
Reference in New Issue
Block a user