MS DG setting diaspora handle in a unclean way
This commit is contained in:
parent
78cc51efb4
commit
b68ec3a5b8
2 changed files with 11 additions and 3 deletions
|
|
@ -30,11 +30,19 @@ class Person
|
|||
|
||||
before_destroy :remove_all_traces
|
||||
before_validation :clean_url
|
||||
validates_presence_of :diaspora_handle, :url, :profile, :serialized_key
|
||||
after_create :ensure_diaspora_handle
|
||||
validates_presence_of :url, :profile, :serialized_key
|
||||
validates_format_of :url, :with =>
|
||||
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
||||
|
||||
|
||||
def ensure_diaspora_handle
|
||||
if self.owner?
|
||||
self.diaspora_handle = self.owner.diaspora_handle
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.search(query)
|
||||
Person.all('$where' => "function() { return this.diaspora_handle.match(/^#{query}/i) ||
|
||||
this.profile.first_name.match(/^#{query}/i) ||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ class User
|
|||
|
||||
###Helpers############
|
||||
def self.instantiate!( opts = {} )
|
||||
opts[:person][:email] = opts[:email]
|
||||
opts[:person][:diaspora_handle] = opts[:email]
|
||||
opts[:person][:serialized_key] = generate_key
|
||||
User.create!( opts)
|
||||
end
|
||||
|
|
@ -305,7 +305,7 @@ class User
|
|||
|
||||
def setup_person
|
||||
self.person.serialized_key ||= User.generate_key.export
|
||||
self.person.diaspora_handle ||= self.diaspora_handle
|
||||
#self.person.diaspora_handle ||= self.diaspora_handle
|
||||
self.person.save!
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue