From 17080730f846163435df3dc7933ec1afc9dfd2f2 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 14:48:26 -0700 Subject: [PATCH 01/12] 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 02/12] 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 03/12] 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 04/12] 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 72c41a5ff8383baa9a41f79d8599131a4f4e9537 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 24 Aug 2010 15:42:24 -0700 Subject: [PATCH 05/12] User post now requires a :to field --- app/models/user.rb | 12 ++++++++---- lib/diaspora/websocket.rb | 1 - spec/controllers/sockets_controller_spec.rb | 2 +- spec/lib/salmon_salmon_spec.rb | 4 ++-- spec/lib/web_hooks_spec.rb | 17 +++-------------- spec/models/group_spec.rb | 2 +- spec/models/retraction_spec.rb | 2 +- spec/models/user/receive_spec.rb | 15 +++++++-------- spec/models/user/visible_posts_spec.rb | 6 +++--- spec/user_encryption_spec.rb | 12 ++++++------ 10 files changed, 32 insertions(+), 41 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b9beb0409..94e104706 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -44,8 +44,12 @@ class User def post(class_name, options = {}) options[:person] = self.person - group_ids = options[:group_ids] - options.delete(:group_ids) + group_ids = options[:to] + group_ids = [group_ids] unless group_ids.is_a? Array + + return nil if group_ids.nil? || group_ids.empty? + group_ids.map!{|gid| ensure_bson gid } + options.delete(:to) model_class = class_name.to_s.camelize.constantize @@ -54,7 +58,7 @@ class User post.save - groups = self.groups.find_all_by_id(group_ids) + groups = self.groups.find_all_by_id( group_ids ) target_people = [] groups.each{ |group| @@ -63,7 +67,7 @@ class User target_people = target_people | group.people } - post.socket_to_uid(id, :group_ids => groups.map{|g| g.id}) if post.respond_to?(:socket_to_uid) + post.socket_to_uid(id, :group_ids => group_ids) if post.respond_to?(:socket_to_uid) post.push_to( target_people ) self.raw_visible_posts << post diff --git a/lib/diaspora/websocket.rb b/lib/diaspora/websocket.rb index 3eb41ed45..f9368356a 100644 --- a/lib/diaspora/websocket.rb +++ b/lib/diaspora/websocket.rb @@ -32,7 +32,6 @@ module Diaspora module Socketable def socket_to_uid(id, opts={}) - puts "#{id}, #{self}, #{opts}" SocketsController.new.outgoing(id, self, opts) end diff --git a/spec/controllers/sockets_controller_spec.rb b/spec/controllers/sockets_controller_spec.rb index 33624cb61..b12cf7ad4 100644 --- a/spec/controllers/sockets_controller_spec.rb +++ b/spec/controllers/sockets_controller_spec.rb @@ -18,7 +18,7 @@ describe 'SocketsController' do describe 'actionhash' do before do - @message = @user.post :status_message, :message => "post through user for victory" + @message = @user.post :status_message, :message => "post through user for victory", :to => @user.group(:name => "losers").id end it 'should actionhash posts' do diff --git a/spec/lib/salmon_salmon_spec.rb b/spec/lib/salmon_salmon_spec.rb index 7b29bf966..273762a41 100644 --- a/spec/lib/salmon_salmon_spec.rb +++ b/spec/lib/salmon_salmon_spec.rb @@ -11,7 +11,7 @@ include Salmon describe Salmon do it 'should verify the signature on a roundtrip' do @user = Factory.create :user - @post = @user.post :status_message, :message => "hi" + @post = @user.post :status_message, :message => "hi", :to => @user.group(:name => "sdg").id x = Salmon::SalmonSlap.create(@user, @post.to_diaspora_xml) z = Salmon::SalmonSlap.parse x.to_xml @@ -29,7 +29,7 @@ describe Salmon do it 'should return the data so it can be "received"' do @user = Factory.create :user - @post = @user.post :status_message, :message => "hi" + @post = @user.post :status_message, :message => "hi", :to => @user.group(:name => "sdg").id x = Salmon::SalmonSlap.create(@user, @post.to_diaspora_xml) z = Salmon::SalmonSlap.parse x.to_xml diff --git a/spec/lib/web_hooks_spec.rb b/spec/lib/web_hooks_spec.rb index 5996a6e3a..fa661049b 100644 --- a/spec/lib/web_hooks_spec.rb +++ b/spec/lib/web_hooks_spec.rb @@ -6,9 +6,8 @@ describe Diaspora do describe Webhooks do before do - @user = Factory.create(:user, :email => "bob@aol.com") - @user.person.save - @person = Factory.create(:person) + @user = Factory.create(:user, :email => "bob@aol.com") + @group = @user.group(:name => "losers") end describe "body" do @@ -22,7 +21,7 @@ describe Diaspora do it "should send an owners post to their people" do message_queue.should_receive :process - @user.post :status_message, :message => "hi" + @user.post :status_message, :message => "hi", :to => @group.id end it "should check that it does not send a person's post to an owners people" do @@ -30,16 +29,6 @@ describe Diaspora do Factory.create(:status_message, :person => Factory.create(:person)) end - it "should ensure one url is created for every person" do - 5.times {@user.friends << Factory.create(:person)} - @user.save - - @post.person.owner.reload - - @post.people_with_permissions.size.should == 5 - end - end end - end diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 93bc9f949..06ac3b576 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -70,7 +70,7 @@ describe Group do it 'should add post to group via post method' do group = @user.group(:name => 'losers', :people => [@friend]) - status_message = @user.post( :status_message, :message => "hey", :group_ids => [group.id] ) + status_message = @user.post( :status_message, :message => "hey", :to => group.id ) group.reload group.posts.include?(status_message).should be true diff --git a/spec/models/retraction_spec.rb b/spec/models/retraction_spec.rb index 5c8695fea..bb344a039 100644 --- a/spec/models/retraction_spec.rb +++ b/spec/models/retraction_spec.rb @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper' describe Retraction do before do @user = Factory.create(:user) - @post = @user.post(:status_message, :message => "Destroy!") + @post = @user.post :status_message, :message => "Destroy!", :to => @user.group(:name => "losers").id @person = Factory.create(:person) @user.friends << @person @user.save diff --git a/spec/models/user/receive_spec.rb b/spec/models/user/receive_spec.rb index a657f41e8..bd2afb6dd 100644 --- a/spec/models/user/receive_spec.rb +++ b/spec/models/user/receive_spec.rb @@ -8,12 +8,11 @@ describe User do @user2 = Factory.create(:user) @group2 = @user2.group(:name => 'losers') - #Factory.create :friend, @user friend_users(@user, @group, @user2, @group2) end it 'should be able to parse and store a status message from xml' do - status_message = @user2.post :status_message, :message => 'store this!' + status_message = @user2.post :status_message, :message => 'store this!', :to => @group2.id person = @user2.person xml = status_message.to_diaspora_xml @@ -30,7 +29,7 @@ describe User do num_groups = @user.groups.size (0..5).each{ |n| - status_message = @user2.post :status_message, :message => "store this #{n}!" + status_message = @user2.post :status_message, :message => "store this #{n}!", :to => @group2.id xml = status_message.to_diaspora_xml @user.receive( xml ) } @@ -45,13 +44,13 @@ describe User do end it "should add the post to that user's posts when a user posts it" do - status_message = @user.post :status_message, :message => "hi" + status_message = @user.post :status_message, :message => "hi", :to => @group.id @user.reload @user.raw_visible_posts.include?(status_message).should be true end it 'should be removed on unfriending' do - status_message = @user2.post :status_message, :message => "hi" + status_message = @user2.post :status_message, :message => "hi", :to => @group2.id @user.receive status_message.to_diaspora_xml @user.reload @@ -66,7 +65,7 @@ describe User do end it 'should be remove a post if the noone links to it' do - status_message = @user2.post :status_message, :message => "hi" + status_message = @user2.post :status_message, :message => "hi", :to => @group2.id @user.receive status_message.to_diaspora_xml @user.reload @@ -83,7 +82,7 @@ describe User do end it 'should keep track of user references for one person ' do - status_message = @user2.post :status_message, :message => "hi" + status_message = @user2.post :status_message, :message => "hi", :to => @group2.id @user.receive status_message.to_diaspora_xml @user.reload @@ -107,7 +106,7 @@ describe User do it 'should not override userrefs on receive by another person' do @user3.activate_friend(@user2.person, @group3) - status_message = @user2.post :status_message, :message => "hi" + status_message = @user2.post :status_message, :message => "hi", :to => @group2.id @user.receive status_message.to_diaspora_xml @user3.receive status_message.to_diaspora_xml diff --git a/spec/models/user/visible_posts_spec.rb b/spec/models/user/visible_posts_spec.rb index 92e8c6403..079586138 100644 --- a/spec/models/user/visible_posts_spec.rb +++ b/spec/models/user/visible_posts_spec.rb @@ -21,9 +21,9 @@ describe User do end it 'should generate a valid stream for a group of people' do - status_message1 = @user2.post :status_message, :message => "hi" - status_message2 = @user3.post :status_message, :message => "heyyyy" - status_message3 = @user4.post :status_message, :message => "yooo" + status_message1 = @user2.post :status_message, :message => "hi", :to => @user2_group.id + status_message2 = @user3.post :status_message, :message => "heyyyy", :to => @user3_group.id + status_message3 = @user4.post :status_message, :message => "yooo", :to => @user4_group.id @user.receive status_message1.to_diaspora_xml @user.receive status_message2.to_diaspora_xml diff --git a/spec/user_encryption_spec.rb b/spec/user_encryption_spec.rb index 896fceb8a..47433b80f 100644 --- a/spec/user_encryption_spec.rb +++ b/spec/user_encryption_spec.rb @@ -62,14 +62,14 @@ describe 'user encryption' do describe 'signing and verifying' do it 'should sign a message on create' do - message = @user.post :status_message, :message => "hi" + message = @user.post :status_message, :message => "hi", :to => @group.id message.signature_valid?.should be true end it 'should sign a retraction on create' do unstub_mocha_stubs - message = @user.post :status_message, :message => "hi" + message = @user.post :status_message, :message => "hi", :to => @group.id retraction = @user.retract(message) @@ -110,7 +110,7 @@ describe 'user encryption' do describe 'sending and recieving signatures' do it 'should contain the signature in the xml' do - message = @user.post :status_message, :message => "hi" + message = @user.post :status_message, :message => "hi", :to => @group.id xml = message.to_xml.to_s xml.include?(message.creator_signature).should be true end @@ -118,7 +118,7 @@ describe 'user encryption' do it 'A message with an invalid signature should be rejected' do @user2 = Factory.create :user - message = @user2.post :status_message, :message => "hey" + message = @user2.post :status_message, :message => "hey", :to => @user2.group(:name => "bruisers").id message.creator_signature = "totally valid" message.save(:validate => false) @@ -135,7 +135,7 @@ describe 'user encryption' do @remote_message = Factory.build(:status_message, :person => @person) @remote_message.creator_signature = @remote_message.send(:sign_with_key,@person.encryption_key) @remote_message.save - @message = @user.post :status_message, :message => "hi" + @message = @user.post :status_message, :message => "hi", :to => @group.id end it 'should attach the creator signature if the user is commenting' do @user.comment "Yeah, it was great", :on => @remote_message @@ -143,7 +143,7 @@ describe 'user encryption' do end it 'should sign the comment if the user is the post creator' do - message = @user.post :status_message, :message => "hi" + message = @user.post :status_message, :message => "hi", :to => @group.id @user.comment "Yeah, it was great", :on => message message.comments.first.signature_valid?.should be true message.comments.first.verify_post_creator_signature.should be true From f3f2eb5abf73a3a1c8433d9a6eff2fdddafd0b97 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 15:43:53 -0700 Subject: [PATCH 06/12] 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 07/12] 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 From abafa03e927eee12547a0a7345bce06d6efa01f2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 24 Aug 2010 15:48:51 -0700 Subject: [PATCH 08/12] Spec for posting to no group --- app/models/user.rb | 4 +++- spec/models/user/posting_spec.rb | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 spec/models/user/posting_spec.rb diff --git a/app/models/user.rb b/app/models/user.rb index 94e104706..0ab382821 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -45,9 +45,11 @@ class User options[:person] = self.person group_ids = options[:to] + + raise "You must post to someone." if group_ids.nil? || group_ids.empty? + group_ids = [group_ids] unless group_ids.is_a? Array - return nil if group_ids.nil? || group_ids.empty? group_ids.map!{|gid| ensure_bson gid } options.delete(:to) diff --git a/spec/models/user/posting_spec.rb b/spec/models/user/posting_spec.rb new file mode 100644 index 000000000..0589de13e --- /dev/null +++ b/spec/models/user/posting_spec.rb @@ -0,0 +1,11 @@ +require File.dirname(__FILE__) + '/../../spec_helper' + +describe User do + before do + @user = Factory.create(:user) + @group = @user.group(:name => 'heroes') + end + it 'should not be able to post without a group' do + proc {@user.post(:status_message, :message => "heyheyhey")}.should raise_error /You must post to someone/ + end +end From e65ce0e5c1e5d9ab81264ea9ded1aee7f109e683 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 15:54:02 -0700 Subject: [PATCH 09/12] Mr. Clean! deploy even cleaner, no more silly way of doing things --- db/seeds/backer.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/seeds/backer.rb b/db/seeds/backer.rb index 3183dcb34..497e88c63 100644 --- a/db/seeds/backer.rb +++ b/db/seeds/backer.rb @@ -19,8 +19,7 @@ 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/user/#{username}.jpg"), + :profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name']), :url=> "http://#{username}.joindiaspora.com/") ) user.person.save From de3044fa0a8a221ca69c63e4b778282671eb258d Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 24 Aug 2010 15:55:35 -0700 Subject: [PATCH 10/12] Remove publisher selection remnants, fix posting --- app/controllers/status_messages_controller.rb | 2 +- app/views/layouts/application.html.haml | 2 +- public/javascripts/publisher.js | 20 ------------------- 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 public/javascripts/publisher.js diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index d5cd07d51..6fd934541 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -2,7 +2,7 @@ class StatusMessagesController < ApplicationController before_filter :authenticate_user! def create - params[:status_message][:group_ids] = params[:group_ids] + params[:status_message][:to] = params[:group_ids] @status_message = current_user.post(:status_message, params[:status_message]) if @status_message.created_at diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 6bd54b894..ac6d76810 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -17,7 +17,7 @@ = javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack' - = javascript_include_tag 'view', 'publisher', 'image_picker', 'group_nav' + = javascript_include_tag 'view', 'image_picker', 'group_nav' = render 'js/websocket_js' = csrf_meta_tag diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js deleted file mode 100644 index 28d902098..000000000 --- a/public/javascripts/publisher.js +++ /dev/null @@ -1,20 +0,0 @@ -$(document).ready( function() { - - $("#publisher_content_pickers .status_message").click(selectPublisherTab); - $("#publisher_content_pickers .bookmark").click(selectPublisherTab); - $("#publisher_content_pickers .blog").click(selectPublisherTab); - $("#publisher_content_pickers .photo").click(selectPublisherTab); - - function selectPublisherTab(evt){ - evt.preventDefault(); - var form_id = "#new_" + this.className - if( $(form_id).css("display") == "none" ) { - $("#publisher_content_pickers").children("li").removeClass("selected"); - $("#publisher_form form").fadeOut(50); - - $(this).toggleClass("selected"); - $(form_id).delay(50).fadeIn(200); - } - } - -}); From f5ae090e9ba300a54c3f073b5da1a7fb3c2341c2 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 16:05:29 -0700 Subject: [PATCH 11/12] posting empty albums to people --- app/controllers/dev_utilities_controller.rb | 2 +- app/models/user.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb index 4f005e6b4..da47a9edc 100644 --- a/app/controllers/dev_utilities_controller.rb +++ b/app/controllers/dev_utilities_controller.rb @@ -58,7 +58,7 @@ def warzombie def set_profile_photo render :nothing => true - album = current_user.post(:album, :name => "Profile Photos") + album = current_user.post( :album, :to => current_user.all_group_ids, :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 diff --git a/app/models/user.rb b/app/models/user.rb index d194940ab..59b7abc5b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -229,6 +229,9 @@ class User self.person.save! end + def all_group_ids + self.groups.all.map{|x| x.id} + end protected def generate_key OpenSSL::PKey::RSA::generate 1024 From 9db48385430417e0a26dc84a5f673fbfc1dd4cd7 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 24 Aug 2010 16:15:59 -0700 Subject: [PATCH 12/12] collecting the ids --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 59b7abc5b..dddc975cb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -230,7 +230,7 @@ class User end def all_group_ids - self.groups.all.map{|x| x.id} + self.groups.all.collect{|x| x.id} end protected def generate_key