Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index bfc97325b..788fe6aba 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -36,10 +36,8 @@ class User < ApplicationRecord
before_validation :set_current_language, :on => :create
before_validation :set_default_color_theme, on: :create
- validates :username, :presence => true, :uniqueness => true
- validates_format_of :username, :with => /\A[A-Za-z0-9_]+\z/
- validates_length_of :username, :maximum => 32
- validates_exclusion_of :username, :in => AppConfig.settings.username_blacklist
+ validates :username, presence: true, uniqueness: true, format: {with: /\A[A-Za-z0-9_.\-]+\z/},
+ length: {maximum: 32}, exclusion: {in: AppConfig.settings.username_blacklist}
validates_inclusion_of :language, :in => AVAILABLE_LANGUAGE_CODES
validates :color_theme, inclusion: {in: AVAILABLE_COLOR_THEMES}, allow_blank: true
validates_format_of :unconfirmed_email, :with => Devise.email_regexp, :allow_blank => true
@@ -444,8 +442,13 @@ class User < ApplicationRecord
aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances'))
if AppConfig.settings.autofollow_on_join?
- default_account = Person.find_or_fetch_by_identifier(AppConfig.settings.autofollow_on_join_user)
- self.share_with(default_account, aq) if default_account
+ begin
+ default_account = Person.find_or_fetch_by_identifier(AppConfig.settings.autofollow_on_join_user)
+ share_with(default_account, aq)
+ rescue DiasporaFederation::Discovery::DiscoveryError
+ logger.warn "Error auto-sharing with #{AppConfig.settings.autofollow_on_join_user}
+ fix autofollow_on_join_user in configuration."
+ end
end
aq
end