From 17080730f846163435df3dc7933ec1afc9dfd2f2 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 14:48:26 -0700 Subject: [PATCH 1/6] opening the file in the set photo --- app/controllers/dev_utilities_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb index 4282b8964..decff8514 100644 --- a/app/controllers/dev_utilities_controller.rb +++ b/app/controllers/dev_utilities_controller.rb @@ -62,8 +62,11 @@ def warzombie backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i username = backer_info[backer_number]['username'].gsub(/ /,'').downcase + + @fixture_name = File.dirname(__FILE__) + "../../../public/images/users/#{username}.jpg" + photo = current_user.post(:photo, :album_id => album.id, - :user_file => "public/images/users/#{username}.jpg") + :user_file => "") current_user.update_profile(:image_url => photo.url) end From 2a28607bc695282e40cf752700790f188f07cafa Mon Sep 17 00:00:00 2001 From: maxwell Date: Tue, 24 Aug 2010 15:22:48 -0700 Subject: [PATCH 2/6] Moved some prod changes into master --- app/views/groups/index.html.haml | 2 +- app/views/photos/_photo.haml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml index 1f9764bbb..2f32555f4 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/index.html.haml @@ -6,7 +6,7 @@ %ul#stream - for post in @posts - = render type_partial(post), :post => post + = render type_partial(post), :post => post unless post.class == Album #pagination = will_paginate @posts diff --git a/app/views/photos/_photo.haml b/app/views/photos/_photo.haml index e15dcb0d5..7523a29ba 100644 --- a/app/views/photos/_photo.haml +++ b/app/views/photos/_photo.haml @@ -8,7 +8,10 @@ = link_to post.album.name, object_path(post.album) %br - = link_to (image_tag post.url(:thumb_large)), object_path(post) + + = render "albums/album", :post => post.album + + = link_to (image_tag post.url(:thumb_medium)), object_path(post) %div.time = link_to(how_long_ago(post), photo_path(post)) From 82d140aa804f900b994f824c36ccb30ce50bfc7b Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 15:23:58 -0700 Subject: [PATCH 3/6] trying to redeploy to get photos working --- app/controllers/dev_utilities_controller.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb index decff8514..9b3110332 100644 --- a/app/controllers/dev_utilities_controller.rb +++ b/app/controllers/dev_utilities_controller.rb @@ -63,11 +63,18 @@ def warzombie backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i username = backer_info[backer_number]['username'].gsub(/ /,'').downcase - @fixture_name = File.dirname(__FILE__) + "../../../public/images/users/#{username}.jpg" - - photo = current_user.post(:photo, :album_id => album.id, - :user_file => "") - - current_user.update_profile(:image_url => photo.url) + @fixture_name = File.dirname(__FILE__) + "/../../public/images/user/#{username}.jpg" + + photo = Photo.new(:person => current_user.person, :album => album) + photo.image.store! File.open(@fixture_name) + photo.save + photo.reload + + current_user.raw_visible_posts << photo + current_user.save + + + current_user.update_profile(:image_url => photo.url(:thumb_medium)) + current_user.save end end From 45f3eb2a9ab55337d7d0977d37abd397f839fe26 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 15:37:55 -0700 Subject: [PATCH 4/6] trying yet again --- config/routes.rb | 1 + db/seeds/backer.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 1f3efbbbd..25a243172 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,7 @@ Diaspora::Application.routes.draw do match 'zombiefriends', :to => "dev_utilities#zombiefriends" match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept" match 'set_backer_number', :to => "dev_utilities#set_backer_number" + match 'set_profile_photo', :to => "dev_utilities#set_profile_photo" #routes for devise, not really sure you will need to mess with this in the future, lets put default, #non mutable stuff in anohter file diff --git a/db/seeds/backer.rb b/db/seeds/backer.rb index f8fe0dc97..3183dcb34 100644 --- a/db/seeds/backer.rb +++ b/db/seeds/backer.rb @@ -20,7 +20,7 @@ def create :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"), + :image_url => "http://#{username}.joindiaspora.com/images/user/#{username}.jpg"), :url=> "http://#{username}.joindiaspora.com/") ) user.person.save From f3f2eb5abf73a3a1c8433d9a6eff2fdddafd0b97 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 15:43:53 -0700 Subject: [PATCH 5/6] Made it green now making it clean --- app/controllers/dev_utilities_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb index 9b3110332..4f005e6b4 100644 --- a/app/controllers/dev_utilities_controller.rb +++ b/app/controllers/dev_utilities_controller.rb @@ -37,8 +37,6 @@ 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) } @@ -58,6 +56,8 @@ def warzombie end def set_profile_photo + + render :nothing => true album = current_user.post(:album, :name => "Profile Photos") backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i From 204c910f660f8ba38a8b69be2e0f75359bcbcefa Mon Sep 17 00:00:00 2001 From: maxwell Date: Tue, 24 Aug 2010 15:47:44 -0700 Subject: [PATCH 6/6] MS fixing small bugs, adding a very dump list of a groups that a friend is in for you --- app/controllers/people_controller.rb | 1 + app/models/user.rb | 4 ++-- app/views/people/show.html.haml | 5 +++-- public/stylesheets/sass/application.sass | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 4019b871c..8b6ae849b 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -14,6 +14,7 @@ class PeopleController < ApplicationController def show @person = current_user.visible_person_by_id(params[:id]) @profile = @person.profile + @person_groups = current_user.groups_with_person(@person) @posts = Post.where(:person_id => @person.id, :_id.in => current_user.visible_post_ids).paginate :page => params[:page], :order => 'created_at DESC' diff --git a/app/models/user.rb b/app/models/user.rb index b9beb0409..a0f06cb5c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,7 +8,7 @@ class User key :friend_ids, Array key :pending_request_ids, Array - key :visible_post_ids, Array + key :_post_ids, Array one :person, :class_name => 'Person', :foreign_key => :owner_id @@ -213,7 +213,7 @@ class User end def groups_with_person person - id = ensure_bson person.id + id = ensure_bson person.object_id groups.select {|group| group.person_ids.include? id} end diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 39c60ec7e..8bf59a1aa 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -6,7 +6,6 @@ %h1 = @person.real_name - unless @person.id == current_user.person.id - .right = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button" @@ -16,6 +15,8 @@ %i= "last seen: #{how_long_ago(@posts.first)}" %li %i= "friends since: #{how_long_ago(@person)}" + %li + ="groups: #{@person_groups}" %li url: = @person.url @@ -31,7 +32,7 @@ %h3= "stream - #{@post_count} item(s)" %ul#stream - for post in @posts - = render type_partial(post), :post => post + = render type_partial(post), :post => post unless post.class == Album = will_paginate @posts - else %h3 no posts to display! diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index b603e790e..c549fffae 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -185,6 +185,7 @@ h1 :weight 200 :color #999 + h3 :position relativex :font