Add specs for xmpp default bookmarks, refactor xmpp job usage
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Râu Cao
2023-04-08 16:37:21 +02:00
parent 705bd63b42
commit ad90fcd539
5 changed files with 68 additions and 47 deletions

View File

@@ -59,11 +59,10 @@ class User < ApplicationRecord
enable_service %w[ discourse ejabberd gitea mediawiki ]
#TODO enable in development when we have easy setup of ejabberd etc.
return if Rails.env.development?
return if Rails.env.development? || !Setting.ejabberd_enabled?
if inviter.present?
exchange_xmpp_contact_with_inviter if Setting.ejabberd_enabled?
end
XmppExchangeContactsJob.perform_later(inviter, self) if inviter.present?
XmppSetDefaultBookmarksJob.perform_later(self)
end
def send_devise_notification(notification, *args)
@@ -134,12 +133,6 @@ 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