diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c428c0735..9ddd5751c 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 357c3b90e..b008dc41a 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 82534c1e4..bd7da1297 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 dd958f810..07c149420 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 bab6710ff..a857e886d 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 1ded8837d..4d95f9172 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 c5883b3b0..8788f18a9 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 6ea925212..88f71831d 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 1ccfe0cd3..492d66897 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 2d96f12e8..4e6d9315d 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 f46a0ca60..414dde600 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 40c062067..69bf65f2c 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 5c1b3365a..e01f93f17 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 8f0a10c12..74f6d7871 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