Skip to content

Instantly share code, notes, and snippets.

@emmaly
Last active December 25, 2018 06:23
Show Gist options
  • Save emmaly/a2773622e03a33370cd37500ee09708d to your computer and use it in GitHub Desktop.
Save emmaly/a2773622e03a33370cd37500ee09708d to your computer and use it in GitHub Desktop.
Forced Autofollow on Login - diaspora
# replacement of `after_database_authentication` in `app/models/user.rb`
def after_database_authentication
# remove any possible remove_after timestamp flag set by maintenance.remove_old_users
unless self.remove_after.nil?
self.remove_after = nil
self.save
end
if AppConfig.settings.autofollow_on_join?
begin
default_account = Person.find_or_fetch_by_identifier(AppConfig.settings.autofollow_on_join_user)
if default_account && default_account.username != self.username
aq = self.aspects.where(:name => I18n.t('aspects.seed.acquaintances')).first
self.share_with(default_account, aq)
end
rescue
# eh, it didn't work?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment