Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
maxwell 2010-08-18 22:59:18 -07:00
commit 8131e413a4

View file

@ -16,7 +16,8 @@ class User
many :groups, :class_name => 'Group' many :groups, :class_name => 'Group'
after_validation_on_create :setup_person before_validation_on_create :assign_key
before_validation :do_bad_things
######## Making things work ######## ######## Making things work ########
key :email, String key :email, String
@ -295,6 +296,11 @@ class User
end end
###Helpers############ ###Helpers############
def self.instantiate( opts = {} )
opts[:person][:email] = opts[:email]
opts[:person][:serialized_key] = generate_key
User.create( opts)
end
def terse_url def terse_url
terse= self.url.gsub(/https?:\/\//, '') terse= self.url.gsub(/https?:\/\//, '')
@ -303,6 +309,10 @@ class User
terse terse
end end
def do_bad_things
self.password_confirmation = self.password
end
def visible_person_by_id( id ) def visible_person_by_id( id )
id = ensure_bson id id = ensure_bson id
return self.person if id == self.person.id return self.person if id == self.person.id