Last active
December 25, 2018 06:23
-
-
Save emmaly/a2773622e03a33370cd37500ee09708d to your computer and use it in GitHub Desktop.
Forced Autofollow on Login - diaspora
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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