remove diaspora_handle setter to set author
This commit is contained in:
parent
5e16b9c7cd
commit
1cf11db634
5 changed files with 3 additions and 20 deletions
|
|
@ -228,8 +228,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
######## Posting ########
|
||||
def build_post(class_name, opts={})
|
||||
opts[:author] = self.person
|
||||
opts[:diaspora_handle] = opts[:author].diaspora_handle
|
||||
opts[:author] = person
|
||||
|
||||
model_class = class_name.to_s.camelize.constantize
|
||||
model_class.diaspora_initialize(opts)
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ module Diaspora
|
|||
validates :author, presence: true
|
||||
end
|
||||
end
|
||||
|
||||
def diaspora_handle=(nh)
|
||||
self.author = Person.find_or_fetch_by_identifier(nh)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -94,9 +94,6 @@ FactoryGirl.define do
|
|||
factory(:status_message, aliases: %i(status_message_without_participation)) do
|
||||
sequence(:text) {|n| "jimmy's #{n} whales" }
|
||||
author
|
||||
after(:build) do |sm|
|
||||
sm.diaspora_handle = sm.author.diaspora_handle
|
||||
end
|
||||
|
||||
factory(:status_message_with_poll) do
|
||||
after(:build) do |sm|
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ describe "attack vectors", type: :request do
|
|||
# bob trys to send a message to alice
|
||||
|
||||
original_message = eve.post(:status_message, text: "store this!", to: eves_aspect.id)
|
||||
original_message.diaspora_handle = bob.diaspora_handle
|
||||
original_message.author = bob.person
|
||||
|
||||
alice.share_with(eve.person, alices_aspect)
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ describe "attack vectors", type: :request do
|
|||
original_message = eve.post(:photo, user_file: uploaded_photo, text: "store this!", to: eves_aspect.id)
|
||||
|
||||
new_message = original_message.dup
|
||||
new_message.diaspora_handle = alice.diaspora_handle
|
||||
new_message.author = alice.person
|
||||
new_message.text = "bad bad bad"
|
||||
new_message.height = 23
|
||||
new_message.width = 42
|
||||
|
|
|
|||
|
|
@ -96,15 +96,6 @@ describe StatusMessage, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#diaspora_handle=" do
|
||||
it "sets #author" do
|
||||
person = FactoryGirl.create(:person)
|
||||
post = FactoryGirl.build(:status_message, author: user.person)
|
||||
post.diaspora_handle = person.diaspora_handle
|
||||
expect(post.author).to eq(person)
|
||||
end
|
||||
end
|
||||
|
||||
context "emptyness" do
|
||||
it "needs either a message or at least one photo" do
|
||||
post = user.build_post(:status_message, text: nil)
|
||||
|
|
|
|||
Loading…
Reference in a new issue