From 319f87f9a83639fe08e0aa27266248b537bbe809 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 12:29:00 -0700 Subject: [PATCH 1/3] trying setting profile photos --- db/seeds/backer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/seeds/backer.rb b/db/seeds/backer.rb index bc5039aa1..64e1522b5 100644 --- a/db/seeds/backer.rb +++ b/db/seeds/backer.rb @@ -19,7 +19,8 @@ def create :password => "#{username+backer_info[backer_number]['pin'].to_s}", :person => Person.new( :email => "#{username}@#{username}.joindiaspora.com", - :profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name'] ), + :profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name'] + , :image_url => "http://#{username}.joindiaspora.com/images/users/#{username}.jpg"), :url=> "http://#{username}.joindiaspora.com/") ) user.person.save From a70132fcdc4b39bb2b78c92cb790959d4dbd0d94 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 14:22:21 -0700 Subject: [PATCH 2/3] IZ we update profile in zombie friends accept --- app/controllers/dev_utilities_controller.rb | 12 ++++++++++++ db/seeds/backer.rb | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb index 5fa140597..b462abd43 100644 --- a/app/controllers/dev_utilities_controller.rb +++ b/app/controllers/dev_utilities_controller.rb @@ -37,6 +37,8 @@ def warzombie def zombiefriendaccept render :nothing => true + set_profile_photo + Request.all.each{|r| current_user.accept_and_respond(r.id, current_user.groups.first.id) } @@ -54,4 +56,14 @@ def warzombie file.write(seed_num_hash.to_yaml) file.close end + + def set_profile_photo + album = current_user.post(:album, :name => "Profile Photos") + + username = backer_info[backer_number]['username'].gsub(/ /,'').downcase + photo = current_user.post(:photo, :album_id => album.id, + :user_file => "public/images/users/#{username}.jpg") + + current_user.update_profile(:image_url => photo.url) + end end diff --git a/db/seeds/backer.rb b/db/seeds/backer.rb index 64e1522b5..f8fe0dc97 100644 --- a/db/seeds/backer.rb +++ b/db/seeds/backer.rb @@ -19,11 +19,12 @@ def create :password => "#{username+backer_info[backer_number]['pin'].to_s}", :person => Person.new( :email => "#{username}@#{username}.joindiaspora.com", - :profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name'] - , :image_url => "http://#{username}.joindiaspora.com/images/users/#{username}.jpg"), + :profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name'], + :image_url => "http://#{username}.joindiaspora.com/images/users/#{username}.jpg"), :url=> "http://#{username}.joindiaspora.com/") ) user.person.save + user.group(:name => "Presidents") end From 27de7f930a8b9433b208d09b5c6733de5762d954 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 14:29:05 -0700 Subject: [PATCH 3/3] forgot the backer number set photo --- app/controllers/dev_utilities_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb index b462abd43..4282b8964 100644 --- a/app/controllers/dev_utilities_controller.rb +++ b/app/controllers/dev_utilities_controller.rb @@ -60,6 +60,7 @@ def warzombie def set_profile_photo album = current_user.post(:album, :name => "Profile Photos") + backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i username = backer_info[backer_number]['username'].gsub(/ /,'').downcase photo = current_user.post(:photo, :album_id => album.id, :user_file => "public/images/users/#{username}.jpg")