Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
8131e413a4
1 changed files with 13 additions and 3 deletions
|
|
@ -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,14 +296,23 @@ 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?:\/\//, '')
|
||||||
terse.gsub!(/www\./, '')
|
terse.gsub!(/www\./, '')
|
||||||
terse = terse.chop! if terse[-1, 1] == '/'
|
terse = terse.chop! if terse[-1, 1] == '/'
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue