diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c428c07352b0de23c87bb620f224cf0b222f0091..9ddd5751cc3cc2f094b4875a9721922ed5decdee 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -14,7 +14,7 @@ class CommentsController < ApplicationController text = params[:text] if target - @comment = current_user.build_comment(:text => text, :on => target) + @comment = current_user.build_comment(:text => text, :post => target) if @comment.save Rails.logger.info("event=create type=comment user=#{current_user.diaspora_handle} status=success comment=#{@comment.id} chars=#{params[:text].length}") diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb index 357c3b90eaa17d0addc4b061945558bd4918063c..b008dc41a7fc5460d6847f096c8a77aba401ff4f 100644 --- a/app/controllers/likes_controller.rb +++ b/app/controllers/likes_controller.rb @@ -12,7 +12,7 @@ class LikesController < ApplicationController target = current_user.find_visible_post_by_id params[:post_id] positive = (params[:positive] == 'true') ? true : false if target - @like = current_user.build_like(:positive => positive, :on => target) + @like = current_user.build_like(:positive => positive, :post => target) if @like.save Rails.logger.info("event=create type=like user=#{current_user.diaspora_handle} status=success like=#{@like.id} positive=#{positive}") diff --git a/app/models/user.rb b/app/models/user.rb index 82534c1e42f1fbae71479bb2d0030048e38c7c71..bd7da12976266f6c790034db17d9b41e24beb420 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,7 +16,7 @@ class User < ActiveRecord::Base :timeoutable, :token_authenticatable before_validation :strip_and_downcase_username - before_validation :set_current_language, :on => :create + before_validation :set_current_language, :post => :create validates_presence_of :username validates_uniqueness_of :username @@ -154,7 +154,6 @@ class User < ActiveRecord::Base end def build_relayable(model, options = {}) - options[:post] = options.delete(:on) m = model.new(options.merge(:author_id => self.person.id)) m.set_guid diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index dd958f81066849e2b31933966ea9ea2acdee3f8c..07c1494206168ddd27d0c052828f50974092bb4b 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -65,7 +65,7 @@ describe AspectsController do it 'generates a jasmine fixture with posts', :fixture => 'jasmine' do message = alice.post(:status_message, :text => "hello "*800, :to => @alices_aspect_2.id) - 4.times { bob.comment("what", :on => message) } + 4.times { bob.comment("what", :post => message) } get :index save_fixture(html_for("body"), "aspects_index_with_posts") @@ -104,7 +104,7 @@ describe AspectsController do post.save! @posts << post end - alice.build_comment(:text => 'lalala', :on => @posts.first ).save + alice.build_comment(:text => 'lalala', :post => @posts.first ).save end describe "post visibilities" do @@ -187,7 +187,7 @@ describe AspectsController do connect_users(alice, @alices_aspect_1, user, aspect) post = alice.post(:status_message, :text => "hello#{n}", :to => @alices_aspect_2.id) 8.times do |n| - user.comment "yo#{post.text}", :on => post + user.comment "yo#{post.text}", :post => post end end end diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index bab6710ff657584ffb94566b04fdaf657dca9f9a..a857e886d9fa1af1d73b33d6c5f193101eb5d236 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -49,7 +49,7 @@ describe CommentsController do end it "doesn't overwrite id" do - old_comment = alice.comment("hello", :on => @post) + old_comment = alice.comment("hello", :post => @post) comment_hash[:id] = old_comment.id post :create, comment_hash old_comment.reload.text.should == 'hello' @@ -73,9 +73,9 @@ describe CommentsController do context 'your post' do before do @message = alice.post(:status_message, :text => "hey", :to => @aspect1.id) - @comment = alice.comment("hey", :on => @message) - @comment2 = bob.comment("hey", :on => @message) - @comment3 = eve.comment("hey", :on => @message) + @comment = alice.comment("hey", :post => @message) + @comment2 = bob.comment("hey", :post => @message) + @comment3 = eve.comment("hey", :post => @message) end it 'lets the user delete his comment' do @@ -94,9 +94,9 @@ describe CommentsController do context "another user's post" do before do @message = bob.post(:status_message, :text => "hey", :to => bob.aspects.first.id) - @comment = alice.comment("hey", :on => @message) - @comment2 = bob.comment("hey", :on => @message) - @comment3 = eve.comment("hey", :on => @message) + @comment = alice.comment("hey", :post => @message) + @comment2 = bob.comment("hey", :post => @message) + @comment3 = eve.comment("hey", :post => @message) end it 'let the user delete his comment' do diff --git a/spec/controllers/likes_controller_spec.rb b/spec/controllers/likes_controller_spec.rb index 1ded8837d1a196f2d082dbbc697c9d3742a1a380..4d95f9172d63447298a792ec10fd98bd0c82f4aa 100644 --- a/spec/controllers/likes_controller_spec.rb +++ b/spec/controllers/likes_controller_spec.rb @@ -53,7 +53,7 @@ describe LikesController do end it "doesn't post multiple times" do - @user1.like(1, :on => @post) + @user1.like(1, :post => @post) post :create, dislike_hash response.code.should == '422' end @@ -76,7 +76,7 @@ describe LikesController do context 'your like' do before do @message = bob.post(:status_message, :text => "hey", :to => @aspect1.id) - @like = alice.build_like(:positive => true, :on => @message) + @like = alice.build_like(:positive => true, :post => @message) @like.save end @@ -87,7 +87,7 @@ describe LikesController do end it 'does not let a user destroy other likes' do - like2 = eve.build_like(:positive => true, :on => @message) + like2 = eve.build_like(:positive => true, :post => @message) like2.save expect { diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index c5883b3b0e7cb7109d37191c1502ed0fb48595ac..8788f18a92fe957cbbc0ad5fb7b769733b82d7b8 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -89,7 +89,7 @@ describe PeopleController do end @posts.each do |post| @users.each do |user| - user.comment "yo#{post.text}", :on => post + user.comment "yo#{post.text}", :post => post end end end @@ -150,7 +150,7 @@ describe PeopleController do it "renders the comments on the user's posts" do message = @user.post :status_message, :text => 'test more', :to => @aspect.id - @user.comment 'I mean it', :on => message + @user.comment 'I mean it', :post => message get :show, :id => @user.person.id response.should be_success end diff --git a/spec/controllers/status_messages_controller_spec.rb b/spec/controllers/status_messages_controller_spec.rb index 6ea92521274ed5d905cc9945e1604295d7b91d6a..88f71831d8a9f3774eab7a7b1872c9e10aca717f 100644 --- a/spec/controllers/status_messages_controller_spec.rb +++ b/spec/controllers/status_messages_controller_spec.rb @@ -54,8 +54,8 @@ describe StatusMessagesController do end it 'marks a corresponding notification as read' do - alice.comment("comment after me", :on => @message) - bob.comment("here you go", :on => @message) + alice.comment("comment after me", :post => @message) + bob.comment("here you go", :post => @message) note = Notification.where(:recipient_id => alice.id, :target_id => @message.id).first lambda{ get :show, :id => @message.id diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb index 1ccfe0cd36a66a8582be64c5b354b9f7c3d0c01d..492d66897c218be437eaa8edb6da15cb57ca0961 100644 --- a/spec/controllers/tags_controller_spec.rb +++ b/spec/controllers/tags_controller_spec.rb @@ -99,7 +99,7 @@ describe TagsController do end it 'succeeds with comments' do - alice.comment('what WHAT!', :on => @post) + alice.comment('what WHAT!', :post => @post) get :show, :name => 'what' response.should be_success end diff --git a/spec/integration/receiving_spec.rb b/spec/integration/receiving_spec.rb index 2d96f12e838799d561a3a644163647b3810c19e7..4e6d9315d097009b090e6a8e793203036f43fff9 100644 --- a/spec/integration/receiving_spec.rb +++ b/spec/integration/receiving_spec.rb @@ -233,7 +233,7 @@ describe 'a user receives a post' do receive_with_zord(bob, alice.person, xml) receive_with_zord(eve, alice.person, xml) - @comment = eve.comment('tada',:on => @post) + @comment = eve.comment('tada',:post => @post) @comment.parent_author_signature = @comment.sign_with_key(alice.encryption_key) @xml = @comment.to_diaspora_xml @comment.delete @@ -290,7 +290,7 @@ describe 'a user receives a post' do end it 'does not raise a `Mysql2::Error: Duplicate entry...` exception on save' do - @comment = bob.comment('tada',:on => @post) + @comment = bob.comment('tada',:post => @post) @xml = @comment.to_diaspora_xml lambda { diff --git a/spec/lib/postzord/dispatch_spec.rb b/spec/lib/postzord/dispatch_spec.rb index f46a0ca60361844d081235368aa64e7a332f6908..414dde60098aa45f4aca31011379e7976d4e4d6b 100644 --- a/spec/lib/postzord/dispatch_spec.rb +++ b/spec/lib/postzord/dispatch_spec.rb @@ -84,7 +84,7 @@ describe Postzord::Dispatch do end context "local leia" do before do - @comment = @local_leia.build_comment :text => "yo", :on => @post + @comment = @local_leia.build_comment :text => "yo", :post => @post @comment.save end context "local leia's mailman" do @@ -156,7 +156,7 @@ describe Postzord::Dispatch do end context "local luke" do before do - @comment = @local_luke.build_comment :text => "yo", :on => @post + @comment = @local_luke.build_comment :text => "yo", :post => @post @comment.save @mailman = Postzord::Dispatch.new(@local_luke, @comment) end @@ -182,7 +182,7 @@ describe Postzord::Dispatch do context "remote raphael's post is commented on by local luke" do before do @post = Factory(:status_message, :author => @remote_raphael) - @comment = @local_luke.build_comment :text => "yo", :on => @post + @comment = @local_luke.build_comment :text => "yo", :post => @post @comment.save @mailman = Postzord::Dispatch.new(@local_luke, @comment) end diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index 40c062067e890a2962c9f0df9c9d0e4202699b83..69bf65f2cc54b48824066a7547041841531c1532 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -163,7 +163,7 @@ describe Notifier do context "comments" do let!(:connect) { connect_users(user, aspect, user2, aspect2)} let!(:sm) {user.post(:status_message, :text => "Sunny outside", :to => :all)} - let!(:comment) { user2.comment("Totally is", :on => sm )} + let!(:comment) { user2.comment("Totally is", :post => sm )} describe ".comment_on_post" do let!(:comment_mail) {Notifier.comment_on_post(user.id, person.id, comment.id).deliver} diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index 5c1b3365a060c113b9e9db4ab82624d548c031d3..e01f93f17d5ead744ca51430358b39beb1ffbc16 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -58,7 +58,7 @@ describe 'making sure the spec runner works' do m.stub!(:post) Postzord::Dispatch.should_receive(:new).and_return(m) - alice.comment "yo", :on => person_status + alice.comment "yo", :post => person_status end end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 8f0a10c12e3b97ab0e4122d1bd8f3380ee0f860d..74f6d787147a6d1dc45199a5bbc26f6045364b67 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -17,19 +17,19 @@ describe Comment do describe 'comment#notification_type' do it "returns 'comment_on_post' if the comment is on a post you own" do - comment = bob.comment("why so formal?", :on => @status) + comment = bob.comment("why so formal?", :post => @status) comment.notification_type(alice, bob.person).should == Notifications::CommentOnPost end it 'returns false if the comment is not on a post you own and no one "also_commented"' do - comment = alice.comment("I simply felt like issuing a greeting. Do step off.", :on => @status) + comment = alice.comment("I simply felt like issuing a greeting. Do step off.", :post => @status) comment.notification_type(@bob, alice.person).should == false end context "also commented" do before do - @bob.comment("a-commenta commenta", :on => @status) - @comment = @eve.comment("I also commented on the first user's post", :on => @status) + @bob.comment("a-commenta commenta", :post => @status) + @comment = @eve.comment("I also commented on the first user's post", :post => @status) end it 'does not return also commented if the user commented' do @@ -45,17 +45,17 @@ describe Comment do describe 'User#comment' do it "should be able to comment on one's own status" do - alice.comment("Yeah, it was great", :on => @status) + alice.comment("Yeah, it was great", :post => @status) @status.reload.comments.first.text.should == "Yeah, it was great" end it "should be able to comment on a contact's status" do - bob.comment("sup dog", :on => @status) + bob.comment("sup dog", :post => @status) @status.reload.comments.first.text.should == "sup dog" end it 'does not multi-post a comment' do lambda { - alice.comment 'hello', :on => @status + alice.comment 'hello', :post => @status }.should change { Comment.count }.by(1) end end @@ -66,7 +66,7 @@ describe Comment do @commenter_aspect = @commenter.aspects.create(:name => "bruisers") connect_users(alice, @alices_aspect, @commenter, @commenter_aspect) @post = alice.post :status_message, :text => "hello", :to => @alices_aspect.id - @comment = @commenter.comment "Fool!", :on => @post + @comment = @commenter.comment "Fool!", :post => @post @xml = @comment.to_xml.to_s end it 'serializes the sender handle' do @@ -104,7 +104,7 @@ describe Comment do mock_http.should_receive(:get).with(/\/feeds\/api\/videos/, nil).twice.and_return( [nil, 'Foobar <title>'+expected_title+'</title> hallo welt <asd><dasdd><a>dsd</a>']) - comment = alice.build_comment :text => url, :on => @message + comment = alice.build_comment :text => url, :post => @message comment.save! Comment.find(comment.id).youtube_titles.should == { first_video_id => CGI::escape(expected_title), second_video_id => CGI::escape(expected_title) } @@ -117,11 +117,11 @@ describe Comment do @remote_parent = Factory.create(:status_message, :author => @remote_raphael) @local_parent = @local_luke.post :status_message, :text => "hi", :to => @local_luke.aspects.first - @object_by_parent_author = @local_luke.comment("yo", :on => @local_parent) - @object_by_recipient = @local_leia.build_comment(:text => "yo", :on => @local_parent) + @object_by_parent_author = @local_luke.comment("yo", :post => @local_parent) + @object_by_recipient = @local_leia.build_comment(:text => "yo", :post => @local_parent) @dup_object_by_parent_author = @object_by_parent_author.dup - @object_on_remote_parent = @local_luke.comment("Yeah, it was great", :on => @remote_parent) + @object_on_remote_parent = @local_luke.comment("Yeah, it was great", :post => @remote_parent) end it_should_behave_like 'it is relayable' end diff --git a/spec/models/like_spec.rb b/spec/models/like_spec.rb index f3b9859b8b124de0d3730c9b1cf860a0cc0c2510..19c0b496319b8a403a3081b728c7d7580029308e 100644 --- a/spec/models/like_spec.rb +++ b/spec/models/like_spec.rb @@ -21,26 +21,26 @@ describe Like do describe 'User#like' do it "should be able to like on one's own status" do - alice.like(1, :on => @status) + alice.like(1, :post => @status) @status.reload.likes.first.positive.should == true end it "should be able to like on a contact's status" do - bob.like(0, :on => @status) + bob.like(0, :post => @status) @status.reload.dislikes.first.positive.should == false end it "does not allow multiple likes" do lambda { - alice.like(1, :on => @status) - alice.like(0, :on => @status) + alice.like(1, :post => @status) + alice.like(0, :post => @status) }.should raise_error end end describe '#notification_type' do before do - @like = @alice.like(1, :on => @status) + @like = @alice.like(1, :post => @status) end it 'should be notifications liked if you are the post owner' do @@ -62,7 +62,7 @@ describe Like do @liker_aspect = @liker.aspects.create(:name => "dummies") connect_users(alice, @alices_aspect, @liker, @liker_aspect) @post = alice.post :status_message, :text => "huhu", :to => @alices_aspect.id - @like = @liker.like 0, :on => @post + @like = @liker.like 0, :post => @post @xml = @like.to_xml.to_s end it 'serializes the sender handle' do @@ -90,11 +90,11 @@ describe Like do @remote_parent = Factory.create(:status_message, :author => @remote_raphael) @local_parent = @local_luke.post :status_message, :text => "foobar", :to => @local_luke.aspects.first - @object_by_parent_author = @local_luke.like(1, :on => @local_parent) - @object_by_recipient = @local_leia.build_like(:positive => 1, :on => @local_parent) + @object_by_parent_author = @local_luke.like(1, :post => @local_parent) + @object_by_recipient = @local_leia.build_like(:positive => 1, :post => @local_parent) @dup_object_by_parent_author = @object_by_parent_author.dup - @object_on_remote_parent = @local_luke.like(0, :on => @remote_parent) + @object_on_remote_parent = @local_luke.like(0, :post => @remote_parent) end it_should_behave_like 'it is relayable' end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index f97b2b2b059ea204cd074951067485d69948d458..4a025d6ff7f205eae3dac35d9f3738bafce61872 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -119,8 +119,8 @@ describe Notification do before do @user3 = bob @sm = @user3.post(:status_message, :text => "comment!", :to => :all) - Postzord::Receiver.new(@user3, :person => @user2.person, :object => @user2.comment("hey", :on => @sm)).receive_object - Postzord::Receiver.new(@user3, :person => @user.person, :object => @user.comment("hey", :on => @sm)).receive_object + Postzord::Receiver.new(@user3, :person => @user2.person, :object => @user2.comment("hey", :post => @sm)).receive_object + Postzord::Receiver.new(@user3, :person => @user.person, :object => @user.comment("hey", :post => @sm)).receive_object end it "updates the notification with a more people if one already exists" do @@ -128,7 +128,7 @@ describe Notification do end it 'handles double comments from the same person without raising' do - Postzord::Receiver.new(@user3, :person => @user2.person, :object => @user2.comment("hey", :on => @sm)).receive_object + Postzord::Receiver.new(@user3, :person => @user2.person, :object => @user2.comment("hey", :post => @sm)).receive_object Notification.where(:recipient_id => @user3.id, :target_type => @sm.class.base_class, :target_id => @sm.id).first.actors.count.should == 2 end diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index fef115151b5d42e44a3d9dbd3a1c406fbad88740..aeb42e951f703ade0c45378f49752e093cf59941 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -171,7 +171,7 @@ describe Photo do context "commenting" do it "accepts comments if there is no parent status message" do - proc{ @user.comment("big willy style", :on => @photo) }.should change(@photo.comments, :count).by(1) + proc{ @user.comment("big willy style", :post => @photo) }.should change(@photo.comments, :count).by(1) end end diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index d63a2641fa5cd0707da1d24c6803b18493ee7812..a591c399caea2638f25bde79fd8a3900a079db99 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -13,7 +13,7 @@ describe Post do describe 'deletion' do it 'should delete a posts comments on delete' do post = Factory.create(:status_message, :author => @user.person) - @user.comment "hey", :on => post + @user.comment "hey", :post => post post.destroy Post.where(:id => post.id).empty?.should == true Comment.where(:text => "hey").empty?.should == true diff --git a/spec/models/relayable_retraction_spec.rb b/spec/models/relayable_retraction_spec.rb index 45f25c201d571ce3e464143d994c51d951724c5b..2c26ba93f47a86dc2de3e91fcb4df74f115b6713 100644 --- a/spec/models/relayable_retraction_spec.rb +++ b/spec/models/relayable_retraction_spec.rb @@ -14,7 +14,7 @@ describe RelayableRetraction do describe '#subscribers' do before do - @comment= @local_luke.comment("yo", :on => @local_parent) + @comment= @local_luke.comment("yo", :post => @local_parent) @retraction= @local_luke.retract(@comment) end it 'delegates it to target' do @@ -26,7 +26,7 @@ describe RelayableRetraction do describe '#receive' do it 'discards a retraction with a nil target' do - @comment= @local_luke.comment("yo", :on => @local_parent) + @comment= @local_luke.comment("yo", :post => @local_parent) @retraction= @local_luke.retract(@comment) @retraction.instance_variable_set(:@target, nil) @@ -36,7 +36,7 @@ describe RelayableRetraction do end context 'from the downstream author' do before do - @comment = @local_leia.comment("yo", :on => @local_parent) + @comment = @local_leia.comment("yo", :post => @local_parent) @retraction = @local_leia.retract(@comment) @recipient = @local_luke end @@ -59,7 +59,7 @@ describe RelayableRetraction do end context 'from the upstream owner' do before do - @comment = @local_luke.comment("Yeah, it was great", :on => @remote_parent) + @comment = @local_luke.comment("Yeah, it was great", :post => @remote_parent) @retraction = RelayableRetraction.allocate @retraction.sender = @remote_raphael @retraction.target = @comment @@ -79,7 +79,7 @@ describe RelayableRetraction do describe 'xml' do before do - @comment = @local_leia.comment("yo", :on => @local_parent) + @comment = @local_leia.comment("yo", :post => @local_parent) @retraction = RelayableRetraction.build(@local_leia, @comment) @retraction.parent_author_signature = 'PARENTSIGNATURE' @retraction.target_author_signature = 'TARGETSIGNATURE' diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2cad8c7db2685d432c8e05089b5b2e6faf883d79..a91214359bbf88235e0bdd83f6095398ab9a1a6a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -562,8 +562,8 @@ describe User do before do @message = alice.post(:status_message, :text => "cool", :to => alice.aspects.first) @message2 = bob.post(:status_message, :text => "uncool", :to => bob.aspects.first) - @like = alice.like(true, :on => @message) - @dislike = bob.like(false, :on => @message) + @like = alice.like(true, :post => @message) + @dislike = bob.like(false, :post => @message) end describe '#like_for' do