diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index e426d4c60944c7bdfbade7653fe491913a3d216b..baf48d0a75a2dfb0979aa21b5892a4b21995e04d 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -30,7 +30,7 @@ class PhotosController < ApplicationController end @posts = current_user.visible_photos.where( - :person_id => @person.id + :author_id => @person.id ).paginate(:page => params[:page]) render 'people/show' @@ -94,8 +94,8 @@ class PhotosController < ApplicationController end def make_profile_photo - person_id = current_user.person.id - @photo = Photo.where(:id => params[:photo_id], :person_id => person_id).first + author_id = current_user.person.id + @photo = Photo.where(:id => params[:photo_id], :author_id => author_id).first if @photo profile_hash = {:image_url => @photo.url(:thumb_large), @@ -108,7 +108,7 @@ class PhotosController < ApplicationController :image_url => @photo.url(:thumb_large), :image_url_medium => @photo.url(:thumb_medium), :image_url_small => @photo.url(:thumb_small), - :person_id => person_id}, + :author_id => author_id}, :status => 201} end else @@ -139,8 +139,8 @@ class PhotosController < ApplicationController end def show - @photo = current_user.visible_photos.where(:id => params[:id]).includes(:person, :status_message => :photos).first - @photo ||= Photo.where(:public => true, :id => params[:id]).includes(:person, :status_message => :photos).first + @photo = current_user.visible_photos.where(:id => params[:id]).includes(:author, :status_message => :photos).first + @photo ||= Photo.where(:public => true, :id => params[:id]).includes(:author, :status_message => :photos).first if @photo @parent = @photo.status_message diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 0ee777a8334f3721a36ca2b523930f8f2b48647a..73ed1f772c542c6767f4db14d8f3184ef72ee7c5 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -11,11 +11,11 @@ class PostsController < ApplicationController skip_before_filter :set_grammatical_gender def show - @post = Post.where(:id => params[:id], :public => true).includes(:person, :comments => :person).first + @post = Post.where(:id => params[:id], :public => true).includes(:author, :comments => :author).first if @post @landing_page = true - @person = @post.person + @person = @post.author if @person.owner_id I18n.locale = @person.owner.language render "posts/#{@post.class.to_s.underscore}", :layout => true diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 51e389bf88abe5c3ca9a719ec633fd2223f960bc..da41db3a1cd48a661f816b36030692f5c240066e 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -47,7 +47,7 @@ class StatusMessagesController < ApplicationController :partial => 'shared/stream_element', :locals => { :post => @status_message, - :person => @status_message.person, + :author => @status_message.author, :photos => @status_message.photos, :comments => [], :all_aspects => current_user.aspects, @@ -61,7 +61,7 @@ class StatusMessagesController < ApplicationController end else respond_to do |format| - format.js { render :json =>{:errors => @status_message.errors.full_messages}, :status => 406 } + format.js { render :json =>{:errors => @status_message.errors.full_messages}, :status => 406 } format.html {redirect_to :back} end end diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 788d7ab03e397d76f4f5784eb635a18a6bcaa4aa..44740644a51d53c207761c33a06f4c526bc42903 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -22,7 +22,7 @@ module NotificationsHelper elsif note.instance_of?(Notifications::AlsoCommented) post = Post.where(:id => note.target_id).first if post - "#{translation(target_type, post.person.name)} #{link_to t('notifications.post'), object_path(post)}".html_safe + "#{translation(target_type, post.author.name)} #{link_to t('notifications.post'), object_path(post)}".html_safe else t('notifications.also_commented_deleted') end diff --git a/app/helpers/sockets_helper.rb b/app/helpers/sockets_helper.rb index b48f5d9a73f9ed1e83eaccaa9b1da4f8fef4aaf5..6e57add60dd9c95062dcbf5164d38128900ffa7a 100644 --- a/app/helpers/sockets_helper.rb +++ b/app/helpers/sockets_helper.rb @@ -26,11 +26,11 @@ module SocketsHelper if object.is_a? StatusMessage post_hash = {:post => object, - :person => object.person, + :author => object.author, :photos => object.photos, :comments => object.comments.map{|c| {:comment => c, - :person => c.person + :author => c.author } }, :current_user => user, @@ -70,12 +70,12 @@ module SocketsHelper if object.is_a? Comment post = object.post action_hash[:comment_id] = object.id - action_hash[:my_post?] = (post.person.owner_id == uid) + action_hash[:my_post?] = (post.author.owner_id == uid) action_hash[:post_guid] = post.guid end - action_hash[:mine?] = object.person && (object.person.owner_id == uid) if object.respond_to?(:person) + action_hash[:mine?] = object.author && (object.author.owner_id == uid) if object.respond_to?(:author) I18n.locale = old_locale unless user.nil? diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 13b90c43ef68153756edc4120b272b58eec6d97d..9f54eeec53fd77142f454b4e9e9b275286e0cc2f 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -84,7 +84,7 @@ class Notifier < ActionMailer::Base @receiver = User.find_by_id(recipient_id) @sender = Person.find_by_id(sender_id) @comment = Comment.find_by_id(comment_id) - @post_author_name = @comment.post.person.name + @post_author_name = @comment.post.author.name log_mail(recipient_id, sender_id, 'comment_on_post') diff --git a/app/models/data_point.rb b/app/models/data_point.rb index 980577f6a937db876e340169eeb48c2397f236c5..93ee893387825c003bb17786c952e99d4dd648dd 100644 --- a/app/models/data_point.rb +++ b/app/models/data_point.rb @@ -3,7 +3,7 @@ class DataPoint < ActiveRecord::Base def self.users_with_posts_on_day(time, number) sql = ActiveRecord::Base.connection() - value = sql.execute("SELECT COUNT(*) FROM (SELECT COUNT(*) AS post_sum, person_id FROM posts WHERE created_at >= '#{(time - 1.days).utc.to_datetime}' AND created_at <= '#{time.utc.to_datetime}' GROUP BY person_id) AS t1 WHERE t1.post_sum = #{number};").first[0] + value = sql.execute("SELECT COUNT(*) FROM (SELECT COUNT(*) AS post_sum, author_id FROM posts WHERE created_at >= '#{(time - 1.days).utc.to_datetime}' AND created_at <= '#{time.utc.to_datetime}' GROUP BY author_id) AS t1 WHERE t1.post_sum = #{number};").first[0] self.new(:key => number.to_s, :value => value) end end diff --git a/app/models/mention.rb b/app/models/mention.rb index 86759d08b027ef7e60d8a9b9fc31b133744bf1dd..98d0c3ef5fab52c7bc48a6a6d0477e299795ca52 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -13,8 +13,8 @@ class Mention < ActiveRecord::Base after_destroy :delete_notification def notify_recipient - Rails.logger.info "event=mention_sent id=#{self.id} to=#{person.diaspora_handle} from=#{post.person.diaspora_handle}" - Notification.notify(person.owner, self, post.person) unless person.remote? + Rails.logger.info "event=mention_sent id=#{self.id} to=#{person.diaspora_handle} from=#{post.author.diaspora_handle}" + Notification.notify(person.owner, self, post.author) unless person.remote? end diff --git a/app/models/person.rb b/app/models/person.rb index e3c1a03eea719e4ae110e592a3f0c687cf26a8f5..5fe05e8f72bd1b7b61609e45b0a49b45c183c651 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -26,7 +26,7 @@ class Person < ActiveRecord::Base end has_many :contacts #Other people's contacts for this person - has_many :posts #his own posts + has_many :posts, :foreign_key => :author_id #his own posts belongs_to :owner, :class_name => 'User' diff --git a/app/models/post.rb b/app/models/post.rb index bd044b5acb9f82b65f5134fbad8173ce2efe627f..adbba4629128584e1e8766e3d070e3218780626d 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -17,35 +17,28 @@ class Post < ActiveRecord::Base has_many :post_visibilities has_many :aspects, :through => :post_visibilities has_many :mentions, :dependent => :destroy - belongs_to :person + belongs_to :author, :class_name => 'Person' cattr_reader :per_page @@per_page = 10 after_destroy :propogate_retraction - def author - self.person - end - def author= author - self.person = author - end - def user_refs self.post_visibilities.count end def diaspora_handle= nd - self.person = Person.where(:diaspora_handle => nd).first + self.author = Person.where(:diaspora_handle => nd).first write_attribute(:diaspora_handle, nd) end def self.diaspora_initialize params new_post = self.new params.to_hash - new_post.person = params[:person] + new_post.author = params[:author] new_post.public = params[:public] if params[:public] new_post.pending = params[:pending] if params[:pending] - new_post.diaspora_handle = new_post.person.diaspora_handle + new_post.diaspora_handle = new_post.author.diaspora_handle new_post end @@ -53,7 +46,7 @@ class Post < ActiveRecord::Base { :post => { :id => self.id, - :person => self.person.as_json, + :author => self.author.as_json, } } end @@ -74,7 +67,7 @@ class Post < ActiveRecord::Base #you know about it, and it is not mutable local_post = Post.where(:guid => self.guid).first - if local_post && local_post.person_id == self.person_id + if local_post && local_post.author_id == self.author_id known_post = user.visible_posts(:guid => self.guid).first if known_post if known_post.mutable? @@ -99,7 +92,7 @@ class Post < ActiveRecord::Base protected def propogate_retraction - self.person.owner.retract(self) if self.person.owner + self.author.owner.retract(self) if self.author.owner end end diff --git a/app/models/post_visibility.rb b/app/models/post_visibility.rb index 99b520de645e2a250163b68ace0d7c432bb5c382..d922051724bd6682ed53182d1c6ffc1f411025bc 100644 --- a/app/models/post_visibility.rb +++ b/app/models/post_visibility.rb @@ -10,6 +10,6 @@ class PostVisibility < ActiveRecord::Base belongs_to :post validates_presence_of :post has_one :user, :through => :aspect - has_one :person, :through => :post + has_one :person, :through => :post, :foreign_key => :author_id end diff --git a/app/models/retraction.rb b/app/models/retraction.rb index c1717e4b03eda5f9b9066611a3bc446bb5b8a567..fa8e9e0b59fcc977e7b0e02624855f40d13b5678 100644 --- a/app/models/retraction.rb +++ b/app/models/retraction.rb @@ -54,7 +54,7 @@ class Retraction return end user.disconnected_by(self.target) - elsif self.target.nil? || self.target.person != self.person + elsif self.target.nil? || self.target.author != self.person Rails.logger.info("event=retraction status=abort reason='no post found authored by retractor' sender=#{person.diaspora_handle} post_guid=#{post_guid}") else self.perform(user) diff --git a/app/models/status_message.rb b/app/models/status_message.rb index 99c94e692c1acaecad2fe721521ee2f2323c7d03..0e306d41982bfe9646930545932d3aa3e8ef3467 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -80,8 +80,8 @@ class StatusMessage < Post <<-XML <entry> <title>#{x(self.message)}</title> - <link rel="alternate" type="text/html" href="#{person.url}status_messages/#{self.id}"/> - <id>#{person.url}posts/#{self.id}</id> + <link rel="alternate" type="text/html" href="#{self.author.url}status_messages/#{self.id}"/> + <id>#{self.author.url}posts/#{self.id}</id> <published>#{self.created_at.xmlschema}</published> <updated>#{self.updated_at.xmlschema}</updated> <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> diff --git a/app/models/user.rb b/app/models/user.rb index 3b8f58c5e0359568cbe6b1fd3a7760df3e228937..5373e7ed86a1a5f23b9cc9471822f2952df5b7c2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -87,8 +87,8 @@ class User < ActiveRecord::Base ######## Posting ######## def build_post(class_name, opts = {}) - opts[:person] = self.person - opts[:diaspora_handle] = opts[:person].diaspora_handle + opts[:author] = self.person + opts[:diaspora_handle] = opts[:author].diaspora_handle model_class = class_name.to_s.camelize.constantize model_class.diaspora_initialize(opts) @@ -108,7 +108,7 @@ class User < ActiveRecord::Base def add_post_to_aspects(post) Rails.logger.debug("event=add_post_to_aspects user_id=#{self.id} post_id=#{post.id}") - add_to_streams(post, self.aspects_with_person(post.person)) + add_to_streams(post, self.aspects_with_person(post.author)) post end diff --git a/app/views/photos/_photo.haml b/app/views/photos/_photo.haml index a601735ae86992217aca03ba95aef287fc3b4958..9d8b8ed18b7befa7ba5c0e627a4a9db78ba65859 100644 --- a/app/views/photos/_photo.haml +++ b/app/views/photos/_photo.haml @@ -10,5 +10,5 @@ %p.photo_description = post.caption -= link_to t('.view_all', :name => post.person.name), person_photos_path(post.person), :class => "small_text" += link_to t('.view_all', :name => post.author.name), person_photos_path(post.author), :class => "small_text" diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 4b825fee371f47487fd59f03297f463973ab7032..b2075e701bd02f88fe56f509c411437ca92f1b45 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -14,7 +14,7 @@ =link_to "#{t('next')} →", @next_photo, :rel => 'prefetch', :id => 'photo_show_right' #original_post_info - = render 'shared/author_info', :person => @photo.person, :post => @photo + = render 'shared/author_info', :person => @photo.author, :post => @photo #photo_container #show_photo{:data=>{:guid=>@photo.id}} @@ -28,7 +28,7 @@ = @photo.caption - if @ownership - .photo_options{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_large)}"}} + .photo_options{:data=>{:actor=>"#{@photo.author.owner.id}", :actor_person => "#{@photo.author.id}", :image_url => "#{@photo.url(:thumb_large)}"}} = link_to t('.make_profile_photo'), {:controller => "photos", :action => "make_profile_photo", :photo_id => @photo.id}, :remote => true, :class => 'make_profile_photo' | = link_to t('.edit'), '#', :id => "edit_photo_toggle" diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index e70d96a2825998d789a378800eccfce48ff57481..18278882de1a3ef35fe31ca33d03820c2ab1675f 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -3,18 +3,18 @@ -# the COPYRIGHT file. .stream_element{:data=>{:guid=>post.id}} - - if post.person.owner_id == current_user.id + - if post.author.owner_id == current_user.id .right.hidden.controls - reshare_aspects = aspects_without_post(all_aspects, post) - unless reshare_aspects.empty? = render 'shared/reshare', :aspects => reshare_aspects, :post => post = link_to image_tag('deletelabel.png'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete", :title => t('delete') - = person_image_link(post.person, :size => :thumb_small) + = person_image_link(post.author, :size => :thumb_small) .content %strong - = person_link(post.person) + = person_link(post.author) = render 'status_messages/status_message', :post => post, :photos => post.photos @@ -23,7 +23,7 @@ %span.aspect_badges %span.aspect_badge.public = t('the_world') - - elsif post.person.owner_id == current_user.id + - elsif post.author.owner_id == current_user.id %span.aspect_badges = aspect_badges(aspects_with_post(all_aspects, post)) diff --git a/app/views/shared/_stream_element.mobile.haml b/app/views/shared/_stream_element.mobile.haml index 00746b0a9439250812fb68aebf5c4d5f6c38a9e1..b313860d1e31e088e6453142c36c22ca5581a782 100644 --- a/app/views/shared/_stream_element.mobile.haml +++ b/app/views/shared/_stream_element.mobile.haml @@ -7,11 +7,11 @@ %span.time = time_ago_in_words(post.created_at) - = person_image_link(post.person, :size => :thumb_small) + = person_image_link(post.author, :size => :thumb_small) .content .from - = person_link(post.person) + = person_link(post.author) = render 'status_messages/status_message', :post => post, :photos => post.photos diff --git a/app/views/status_messages/show.html.haml b/app/views/status_messages/show.html.haml index a5dc196c42c1ce1fa937740b30314414c2879728..e79b894717700716797578e4d7a917e9751bff44 100644 --- a/app/views/status_messages/show.html.haml +++ b/app/views/status_messages/show.html.haml @@ -5,7 +5,7 @@ .span-16.append-4.prepend-4.last #original_post_info - = render 'shared/author_info', :person => @status_message.person, :post => @status_message + = render 'shared/author_info', :person => @status_message.author, :post => @status_message #show_text %p diff --git a/app/views/status_messages/show.mobile.haml b/app/views/status_messages/show.mobile.haml index 8efa3f0d7710f47440cded1199493700c2d309bc..2758551174113003b1bc417a77e3ecbaf86f4806 100644 --- a/app/views/status_messages/show.mobile.haml +++ b/app/views/status_messages/show.mobile.haml @@ -3,7 +3,7 @@ -# the COPYRIGHT file. #show_content{:data=>{:guid=>@status_message.id}} - = render 'shared/author_info', :person => @status_message.person, :post => @status_message + = render 'shared/author_info', :person => @status_message.author, :post => @status_message %p = markdownify(@status_message.message, :youtube_maps => @status_message[:youtube_titles]) diff --git a/db/migrate/20110301014507_rename_person_to_author.rb b/db/migrate/20110301014507_rename_person_to_author.rb index 30bbdadff6839cc8b345ffdc993561e5c2b49e4c..1233924455efe7c110e35ab62dd9e6792e8898fa 100644 --- a/db/migrate/20110301014507_rename_person_to_author.rb +++ b/db/migrate/20110301014507_rename_person_to_author.rb @@ -1,13 +1,19 @@ class RenamePersonToAuthor < ActiveRecord::Migration def self.up remove_foreign_key(:comments, :people) + remove_foreign_key(:posts, :people) rename_column :comments, :person_id, :author_id + rename_column :posts, :person_id, :author_id add_foreign_key(:comments, :people, :column => :author_id, :dependent => :delete) + add_foreign_key(:posts, :people, :column => :author_id, :dependent => :delete) end def self.down remove_foreign_key(:comments, :people, :column => :author_id) + remove_foreign_key(:posts, :people, :column => :author_id) rename_column :comments, :author_id, :person_id + rename_column :posts, :author_id, :person_id add_foreign_key(:comments, :people, :dependent => :delete) + add_foreign_key(:posts, :people, :dependent => :delete) end end diff --git a/db/schema.rb b/db/schema.rb index 469ad4f92ffdabf72916d52406ffdb690044894d..e85ca62fd230fca9aadaddfe2c2ca11e4b5f45cf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -389,7 +389,7 @@ ActiveRecord::Schema.define(:version => 20110301014507) do add_index "post_visibilities", ["post_id"], :name => "index_post_visibilities_on_post_id" create_table "posts", :force => true do |t| - t.integer "person_id", :null => false + t.integer "author_id", :null => false t.boolean "public", :default => false, :null => false t.string "diaspora_handle" t.string "guid", :null => false @@ -408,9 +408,9 @@ ActiveRecord::Schema.define(:version => 20110301014507) do t.string "mongo_id" end + add_index "posts", ["author_id"], :name => "index_posts_on_person_id" add_index "posts", ["guid"], :name => "index_posts_on_guid" add_index "posts", ["mongo_id"], :name => "index_posts_on_mongo_id" - add_index "posts", ["person_id"], :name => "index_posts_on_person_id" add_index "posts", ["status_message_id", "pending"], :name => "index_posts_on_status_message_id_and_pending" add_index "posts", ["status_message_id"], :name => "index_posts_on_status_message_id" add_index "posts", ["type", "pending", "id"], :name => "index_posts_on_type_and_pending_and_id" @@ -522,7 +522,7 @@ ActiveRecord::Schema.define(:version => 20110301014507) do add_foreign_key "notification_actors", "notifications", :name => "notification_actors_notification_id_fk", :dependent => :delete - add_foreign_key "posts", "people", :name => "posts_person_id_fk", :dependent => :delete + add_foreign_key "posts", "people", :name => "posts_author_id_fk", :column => "author_id", :dependent => :delete add_foreign_key "profiles", "people", :name => "profiles_person_id_fk", :dependent => :delete diff --git a/lib/diaspora/exporter.rb b/lib/diaspora/exporter.rb index f1815141328d7d84c42e32d6cafb18649eaabab0..adb33d26da74ac460b299ee59c2ad16b717c1e0c 100644 --- a/lib/diaspora/exporter.rb +++ b/lib/diaspora/exporter.rb @@ -37,7 +37,7 @@ module Diaspora #} xml.post_ids { - aspect.posts.find_all_by_person_id(user_person_id).each do |post| + aspect.posts.find_all_by_author_id(user_person_id).each do |post| xml.post_id post.id end } @@ -64,7 +64,7 @@ module Diaspora } xml.posts { - user.raw_visible_posts.find_all_by_person_id(user_person_id).each do |post| + user.raw_visible_posts.find_all_by_author_id(user_person_id).each do |post| #post.comments.each do |comment| # post_doc << comment.to_xml #end diff --git a/lib/diaspora/user/connecting.rb b/lib/diaspora/user/connecting.rb index e3a0c35fe18519c88edb73c901b89fa5f9217c6d..a2101436581387f77a9c79c69070f40c802886c4 100644 --- a/lib/diaspora/user/connecting.rb +++ b/lib/diaspora/user/connecting.rb @@ -84,9 +84,9 @@ module Diaspora def remove_contact(contact) bad_person_id = contact.person_id - posts = raw_visible_posts.where(:person_id => bad_person_id).all + posts = raw_visible_posts.where(:author_id => bad_person_id).all visibilities = PostVisibility.joins(:post, :aspect).where( - :posts => {:person_id => bad_person_id}, + :posts => {:author_id => bad_person_id}, :aspects => {:user_id => self.id} ) visibility_ids = visibilities.map{|v| v.id} diff --git a/lib/diaspora/user/querying.rb b/lib/diaspora/user/querying.rb index e202452675279d7122e26c4a7610d7d2e3046921..25c90d0f25b142ca4c89e45b619dcf20520e83bc 100644 --- a/lib/diaspora/user/querying.rb +++ b/lib/diaspora/user/querying.rb @@ -7,7 +7,7 @@ module Diaspora module Querying def find_visible_post_by_id( id ) - self.raw_visible_posts.where(:id => id).includes({:person => :profile}, {:comments => {:author => :profile}}, :photos).first + self.raw_visible_posts.where(:id => id).includes({:author => :profile}, {:comments => {:author => :profile}}, :photos).first end def raw_visible_posts diff --git a/lib/fake.rb b/lib/fake.rb index fbf25e66bb495d01fa229ef013c901e4e604b19b..8149bda4742090c9bf296a193fd625db8e2f103f 100644 --- a/lib/fake.rb +++ b/lib/fake.rb @@ -8,7 +8,7 @@ class PostsFake def initialize(posts) author_ids = [] posts.each do |p| - author_ids << p.person_id + author_ids << p.author_id p.comments.each do |c| author_ids << c.author_id end diff --git a/lib/postzord/receiver.rb b/lib/postzord/receiver.rb index bfc56ab110e1fcfc4490d79b88eab605c0e0abd3..7281729d362db67c0cc17726757707cc2d462289 100644 --- a/lib/postzord/receiver.rb +++ b/lib/postzord/receiver.rb @@ -51,7 +51,7 @@ module Postzord def xml_author if @object.is_a?(Comment) #if A and B are friends, and A sends B a comment from C, we delegate the validation to the owner of the post being commented on - xml_author = @user.owns?(@object.post) ? @object.diaspora_handle : @object.post.person.diaspora_handle + xml_author = @user.owns?(@object.post) ? @object.diaspora_handle : @object.post.author.diaspora_handle @author = Webfinger.new(@object.diaspora_handle).fetch else xml_author = @object.diaspora_handle @@ -82,6 +82,7 @@ module Postzord end if @author + @object.author = @author if @object.respond_to? :author= @object.person = @author if @object.respond_to? :person= end diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index e2e4423326b7313759b3d52a4186d5bda0957a51..d7f0ceaf5a50005b141d9f5e8a846a4b8bf3ae4b 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -18,7 +18,7 @@ describe PhotosController do @photo2 = @user2.post(:photo, :user_file => uploaded_photo, :to => @aspect2.id, :public => true) @controller.stub!(:current_user).and_return(@user1) - sign_in :user, @user1 + sign_in :user, @user1 request.env["HTTP_REFERER"] = '' end @@ -128,9 +128,9 @@ describe PhotosController do it "doesn't overwrite random attributes" do new_user = Factory.create(:user) - params = { :caption => "now with lasers!", :person_id => new_user.id } + params = { :caption => "now with lasers!", :author_id => new_user.id } put :update, :id => @photo1.id, :photo => params - @photo1.reload.person_id.should == @user1.person.id + @photo1.reload.author_id.should == @user1.person.id end it 'redirects if you do not have access to the post' do diff --git a/spec/controllers/status_messages_controller_spec.rb b/spec/controllers/status_messages_controller_spec.rb index 4f3afa575b110811447effec4d61505d1158d4f2..f6c2b7591bb5e5e43680cc7c7588550368d9a430 100644 --- a/spec/controllers/status_messages_controller_spec.rb +++ b/spec/controllers/status_messages_controller_spec.rb @@ -73,11 +73,11 @@ describe StatusMessagesController do post :create, status_message_hash end - it "doesn't overwrite person_id" do - status_message_hash[:status_message][:person_id] = @user2.person.id + it "doesn't overwrite author_id" do + status_message_hash[:status_message][:author_id] = @user2.person.id post :create, status_message_hash new_message = StatusMessage.find_by_message(status_message_hash[:status_message][:message]) - new_message.person_id.should == @user1.person.id + new_message.author_id.should == @user1.person.id end it "doesn't overwrite id" do diff --git a/spec/factories.rb b/spec/factories.rb index 9c6485da7e21ae9f637f9d09639408118bb2bd7a..72cc39a056d45bdfa3cfee801c418f829c90d319 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -62,11 +62,11 @@ Factory.define :aspect do |aspect| aspect.association :user end -Factory.define :status_message do |m| +Factory.define(:status_message) do |m| m.sequence(:message) { |n| "jimmy's #{n} whales" } - m.association :person + m.association :author, :factory => :person m.after_build do|m| - m.diaspora_handle = m.person.diaspora_handle + m.diaspora_handle = m.author.diaspora_handle end end diff --git a/spec/intergration/receiving_spec.rb b/spec/intergration/receiving_spec.rb index 703e9707d9f2ddd074d62658fc324086b842efd9..16e459086ed3d5e1019dbc2a493325ef552ad780 100644 --- a/spec/intergration/receiving_spec.rb +++ b/spec/intergration/receiving_spec.rb @@ -115,35 +115,29 @@ describe 'a user receives a post' do @user1.raw_visible_posts.should_not include @status_message end - it 'deletes a post if the noone links to it' do - person = Factory(:person) - @user1.activate_contact(person, @aspect) - post = Factory.create(:status_message, :person => person) - post.post_visibilities.should be_empty - receive_with_zord(@user1, person, post.to_diaspora_xml) - @aspect.post_visibilities.reset - @aspect.posts(true).should include(post) - post.post_visibilities.reset - post.post_visibilities.length.should == 1 + context 'dependant delete' do + before do + @person = Factory(:person) + @user1.activate_contact(@person, @aspect) + @post = Factory.create(:status_message, :author => @person) + @post.post_visibilities.should be_empty + receive_with_zord(@user1, @person, @post.to_diaspora_xml) + @aspect.post_visibilities.reset + @aspect.posts(true).should include(@post) + @post.post_visibilities.reset + end - lambda { - @user1.disconnected_by(person) - }.should change(Post, :count).by(-1) - end - it 'deletes post_visibilities on disconnected by' do - person = Factory(:person) - @user1.activate_contact(person, @aspect) - post = Factory.create(:status_message, :person => person) - post.post_visibilities.should be_empty - receive_with_zord(@user1, person, post.to_diaspora_xml) - @aspect.post_visibilities.reset - @aspect.posts(true).should include(post) - post.post_visibilities.reset - post.post_visibilities.length.should == 1 + it 'deletes a post if the noone links to it' do + lambda { + @user1.disconnected_by(@person) + }.should change(Post, :count).by(-1) + end - lambda { - @user1.disconnected_by(person) - }.should change{post.post_visibilities(true).count}.by(-1) + it 'deletes post_visibilities on disconnected by' do + lambda { + @user1.disconnected_by(@person) + }.should change{@post.post_visibilities(true).count}.by(-1) + end end it 'should keep track of user references for one person ' do @status_message.reload @@ -254,11 +248,11 @@ describe 'a user receives a post' do describe 'receiving mulitple versions of the same post from a remote pod' do before do @local_luke, @local_leia, @remote_raphael = set_up_friends - @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :person => @remote_raphael, :created_at => 5.days.ago, :updated_at => 5.days.ago) + @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :author=> @remote_raphael, :created_at => 5.days.ago, :updated_at => 5.days.ago) end it 'does not update created_at or updated_at when two people save the same post' do - @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :person => @remote_raphael, :created_at => 5.days.ago, :updated_at => 5.days.ago) + @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :author=> @remote_raphael, :created_at => 5.days.ago, :updated_at => 5.days.ago) xml = @post.to_diaspora_xml receive_with_zord(@local_luke, @remote_raphael, xml) sleep(2) @@ -269,11 +263,11 @@ describe 'a user receives a post' do end it 'does not update the post if a new one is sent with a new created_at' do - @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :person => @remote_raphael, :created_at => 5.days.ago) + @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :author => @remote_raphael, :created_at => 5.days.ago) old_time = @post.created_at xml = @post.to_diaspora_xml receive_with_zord(@local_luke, @remote_raphael, xml) - @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :person => @remote_raphael, :created_at => 2.days.ago) + @post = Factory.build(:status_message, :message => 'hey', :guid => 12313123, :author => @remote_raphael, :created_at => 2.days.ago) receive_with_zord(@local_luke, @remote_raphael, xml) (Post.find_by_guid @post.guid).created_at.day.should == old_time.day end diff --git a/spec/lib/data_conversion/import_to_mysql_spec.rb b/spec/lib/data_conversion/import_to_mysql_spec.rb index 8d55ad6a0d3f06fd8b127991fa4fa318f194a4b7..84020690514e5ee564451a282ada87f6ef390b61 100644 --- a/spec/lib/data_conversion/import_to_mysql_spec.rb +++ b/spec/lib/data_conversion/import_to_mysql_spec.rb @@ -357,8 +357,8 @@ describe DataConversion::ImportToMysql do post.image.should be_nil post.mongo_id.should == "4d2b6ebecc8cb43cc2000027" post.guid.should == post.mongo_id - post.person_id.should == Person.where(:mongo_id => mongo_post.person_mongo_id).first.id - post.diaspora_handle.should == post.person.diaspora_handle + post.author_id.should == Person.where(:mongo_id => mongo_post.person_mongo_id).first.id + post.diaspora_handle.should == post.author.diaspora_handle post.message.should == "User2 can see this" post.created_at.should == mongo_post.created_at post.updated_at.should == mongo_post.updated_at @@ -379,8 +379,8 @@ describe DataConversion::ImportToMysql do post.image.file.file.should =~ /mUKUIxkYlV4d2b6ebfcc8cb43cc200002d\.png/ post.mongo_id.should == "4d2b6ebfcc8cb43cc200002d" post.guid.should == post.mongo_id - post.person_id.should == Person.where(:mongo_id => mongo_post.person_mongo_id).first.id - post.diaspora_handle.should == post.person.diaspora_handle + post.author_id.should == Person.where(:mongo_id => mongo_post.person_mongo_id).first.id + post.diaspora_handle.should == post.author.diaspora_handle post.message.should be_nil post.created_at.should == mongo_post.created_at post.updated_at.should == mongo_post.updated_at diff --git a/spec/lib/fake_spec.rb b/spec/lib/fake_spec.rb index 9ea25519efc9701f2a52c9feb81d51a75bed358b..0cf749568bbfb8de03154bd97a4e6af862c7443d 100644 --- a/spec/lib/fake_spec.rb +++ b/spec/lib/fake_spec.rb @@ -5,7 +5,7 @@ describe PostsFake do @people = [] 4.times do post = Factory(:status_message) - @people << post.person + @people << post.author 4.times do comment = Factory(:comment, :post => post) @people << comment.author diff --git a/spec/lib/postzord/dispatch_spec.rb b/spec/lib/postzord/dispatch_spec.rb index 6fa20bccb84978933a6b025494f7b1e4410c8a2a..f46391f27fc0d3760efd9238dbf5d5c711808e17 100644 --- a/spec/lib/postzord/dispatch_spec.rb +++ b/spec/lib/postzord/dispatch_spec.rb @@ -181,7 +181,7 @@ describe Postzord::Dispatch do end context "remote raphael's post is commented on by local luke" do before do - @post = Factory(:status_message, :person => @remote_raphael) + @post = Factory(:status_message, :author => @remote_raphael) @comment = @local_luke.build_comment "yo", :on => @post @comment.save @mailman = Postzord::Dispatch.new(@local_luke, @comment) @@ -304,7 +304,7 @@ describe Postzord::Dispatch do it 'queues Job::NotifyLocalUsers jobs' do @zord.instance_variable_get(:@object).should_receive(:socket_to_user).and_return(false) - Resque.should_receive(:enqueue).with(Job::NotifyLocalUsers, @local_user.id, @sm.class.to_s, @sm.id, @sm.person.id) + Resque.should_receive(:enqueue).with(Job::NotifyLocalUsers, @local_user.id, @sm.class.to_s, @sm.id, @sm.author.id) @zord.send(:socket_and_notify_users, [@local_user]) end end diff --git a/spec/lib/web_hooks_spec.rb b/spec/lib/web_hooks_spec.rb index 359ced22f7963133c672d65c950b6695e1c59a66..9ee6d4c389cbb65acc5c74235c3219f30d480785 100644 --- a/spec/lib/web_hooks_spec.rb +++ b/spec/lib/web_hooks_spec.rb @@ -5,12 +5,10 @@ require 'spec_helper' describe Diaspora::Webhooks do - before do - @user = Factory.build(:user) - @post = Factory.build(:status_message, :person => @user.person) - end - it "should add the following methods to Post on inclusion" do - @post.respond_to?(:to_diaspora_xml).should be true + user = Factory.build(:user) + post = Factory.build(:status_message, :author => user.person) + + post.respond_to?(:to_diaspora_xml).should be true end end diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index f3db5ab382efa39fc5236e41e9499efc66818c91..968e71520f8349c68c664ecb294fc387ff80c1f6 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -87,7 +87,7 @@ describe Notifier do @sm = Factory(:status_message) @m = Mention.create(:person => @user.person, :post=> @sm) - @mail = Notifier.mentioned(@user.id, @sm.person.id, @m.id) + @mail = Notifier.mentioned(@user.id, @sm.author.id, @m.id) end it 'goes to the right person' do @mail.to.should == [@user.email] @@ -98,7 +98,7 @@ describe Notifier do end it 'has the name of person mentioning in the body' do - @mail.body.encoded.include?(@sm.person.name).should be true + @mail.body.encoded.include?(@sm.author.name).should be true end it 'has the post text in the body' do diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index 149a4e78660f90fcc656e9a9162f929989691254..f95f443ae50024e7270f6a57fde8ac38285295da 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -53,7 +53,7 @@ describe 'making sure the spec runner works' do describe '#comment' do it "should send a user's comment on a person's post to that person" do person = Factory.create(:person) - person_status = Factory.create(:status_message, :person => person) + person_status = Factory.create(:status_message, :author => person) m = mock() m.stub!(:post) Postzord::Dispatch.should_receive(:new).and_return(m) diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb index bf7a2548cbf1ff4720744841a067d15bd57fa353..9c8f819390298b3899f7735b18dba19fefeebef6 100644 --- a/spec/models/aspect_spec.rb +++ b/spec/models/aspect_spec.rb @@ -114,7 +114,7 @@ describe Aspect do aspect = user.aspects.create(:name => 'losers') contact = aspect.contacts.create(:person => connected_person) - status_message = user.post( :status_message, :message => "hey", :to => aspect.id ) + status_message = user.post(:status_message, :message => "hey", :to => aspect.id) aspect.reload aspect.posts.include?(status_message).should be true diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index ee4b662892e3d0d9c535b7201ff641950a4590c1..030755e3b6238b84cc05c334646a9c8bb58f1214 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -112,7 +112,7 @@ describe Comment do describe 'it is relayable' do before do @local_luke, @local_leia, @remote_raphael = set_up_friends - @remote_parent = Factory.create(:status_message, :person => @remote_raphael) + @remote_parent = Factory.create(:status_message, :author => @remote_raphael) @local_parent = @local_luke.post :status_message, :message => "hi", :to => @local_luke.aspects.first @object_by_parent_author = @local_luke.comment("yo", :on => @local_parent) diff --git a/spec/models/conversation_visibility_spec.rb b/spec/models/conversation_visibility_spec.rb index 691b61b0e0913da7f474d730d18c3f0bef72274c..fff04d7e115c27c0ca78898947622d74fb24b533 100644 --- a/spec/models/conversation_visibility_spec.rb +++ b/spec/models/conversation_visibility_spec.rb @@ -6,7 +6,7 @@ describe ConversationVisibility do @aspect = @user.aspects.create(:name => 'Boozers') @person = Factory(:person) - @post = Factory(:status_message, :person => @person) + @post = Factory(:status_message, :author => @person) end it 'has an aspect' do pv = PostVisibility.new(:aspect => @aspect) diff --git a/spec/models/jobs/mail_mentioned_spec.rb b/spec/models/jobs/mail_mentioned_spec.rb index a186ee623c0817df8dcb14db5508b02251ad0873..5680a3f3f613bc18c70c463fd1b4c9f21e1d4244 100644 --- a/spec/models/jobs/mail_mentioned_spec.rb +++ b/spec/models/jobs/mail_mentioned_spec.rb @@ -13,9 +13,9 @@ describe Job::MailMentioned do mail_mock = mock() mail_mock.should_receive(:deliver) - Notifier.should_receive(:mentioned).with(user.id, sm.person.id, m.id).and_return(mail_mock) + Notifier.should_receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_mock) - Job::MailMentioned.perform_delegate(user.id, sm.person.id, m.id) + Job::MailMentioned.perform_delegate(user.id, sm.author.id, m.id) end end end diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index 8f08abcc4762b7a6cd0cfbb6e07677ee00f56b7f..51aeb7d29540e056973ae70a9a911e53edb12d6e 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -17,7 +17,7 @@ describe Mention do end it 'notifies the person being mention' do - Notification.should_receive(:notify).with(@user, @m, @sm.person) + Notification.should_receive(:notify).with(@user, @m, @sm.author) @m.save end diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index ab1778f0c3671ea2a6a9dc63cb57a53b4933f67c..15b5375e0ef4ac486491da469ca9c414aa81b5e5 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -101,8 +101,8 @@ describe Person do end it '#owns? posts' do - person_message = Factory.create(:status_message, :person => @person) - person_two = Factory.create(:person) + person_message = Factory.create(:status_message, :author => @person) + person_two = Factory.create(:person) @person.owns?(person_message).should be true person_two.owns?(person_message).should be false @@ -111,8 +111,8 @@ describe Person do describe '#remove_all_traces' do before do @deleter = Factory(:person) - @status = Factory.create(:status_message, :person => @deleter) - @other_status = Factory.create(:status_message, :person => @person) + @status = Factory.create(:status_message, :author => @deleter) + @other_status = Factory.create(:status_message, :author => @person) end it "deletes all notifications from a person's actions" do diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 3b19fd145320c2118a5e63f797f7f35face2fcb9..692ffb267e8987470e763cadfa4abea0f7bfb13e 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -20,13 +20,13 @@ describe Photo do describe "protected attributes" do it "doesn't allow mass assignment of person" do @photo.save! - @photo.update_attributes(:person => Factory(:person)) - @photo.reload.person.should == @user.person + @photo.update_attributes(:author => Factory(:person)) + @photo.reload.author.should == @user.person end it "doesn't allow mass assignment of person_id" do @photo.save! - @photo.update_attributes(:person_id => Factory(:person).id) - @photo.reload.person.should == @user.person + @photo.update_attributes(:author_id => Factory(:person).id) + @photo.reload.author.should == @user.person end it 'allows assignmant of caption' do @photo.save! @@ -50,14 +50,14 @@ describe Photo do it 'has a constructor' do image = File.open(@fixture_name) photo = Photo.diaspora_initialize( - :person => @user.person, :user_file => image) + :author => @user.person, :user_file => image) photo.created_at.nil?.should be_true photo.image.read.nil?.should be_false end it 'sets a remote url' do image = File.open(@fixture_name) photo = Photo.diaspora_initialize( - :person => @user.person, :user_file => image) + :author => @user.person, :user_file => image) photo.remote_photo_path.should include("http") photo.remote_photo_name.should include(".png") end @@ -139,7 +139,7 @@ describe Photo do xml = @photo.to_diaspora_xml @photo.destroy - zord = Postzord::Receiver.new(user2, :person => @photo.person) + zord = Postzord::Receiver.new(user2, :person => @photo.author) zord.parse_and_receive(xml) new_photo = Photo.where(:guid => @photo.guid).first diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 96b56e22b54382874a8ca8374365760e71703400..d2b8c7bb5d2dc92ba6042954c169e278de846db9 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -12,7 +12,7 @@ describe Post do describe 'deletion' do it 'should delete a posts comments on delete' do - post = Factory.create(:status_message, :person => @user.person) + post = Factory.create(:status_message, :author => @user.person) @user.comment "hey", :on => post post.destroy Post.where(:id => post.id).empty?.should == true diff --git a/spec/models/post_visibility_spec.rb b/spec/models/post_visibility_spec.rb index 3c2cf91c3480ed98d898fc468a9adee8c1b9c06c..ae8a1141cb2f9da8a8b1c5659e71ba9a29f0a84b 100644 --- a/spec/models/post_visibility_spec.rb +++ b/spec/models/post_visibility_spec.rb @@ -6,7 +6,7 @@ describe PostVisibility do @aspect = @user.aspects.create(:name => 'Boozers') @person = Factory(:person) - @post = Factory(:status_message, :person => @person) + @post = Factory(:status_message, :author => @person) end it 'has an aspect' do pv = PostVisibility.new(:aspect => @aspect) diff --git a/spec/models/status_message_spec.rb b/spec/models/status_message_spec.rb index f368c2c6b2c7b64feaef5cf93d6215e19b6f5fd9..e77556cf0aced49816f124e543c3c0c72c374884 100644 --- a/spec/models/status_message_spec.rb +++ b/spec/models/status_message_spec.rb @@ -21,11 +21,11 @@ describe StatusMessage do end describe '#diaspora_handle=' do - it 'sets #person' do + it 'sets #author' do person = Factory.create(:person) - post = Factory.create(:status_message, :person => @user.person) + post = Factory.create(:status_message, :author => @user.person) post.diaspora_handle = person.diaspora_handle - post.person.should == person + post.author.should == person end end it "should have either a message or at least one photo" do @@ -150,7 +150,7 @@ STR end describe "XML" do before do - @message = Factory.create(:status_message, :message => "I hate WALRUSES!", :person => @user.person) + @message = Factory.create(:status_message, :message => "I hate WALRUSES!", :author => @user.person) @xml = @message.to_xml.to_s end it 'serializes the unescaped, unprocessed message' do @@ -176,7 +176,7 @@ STR @marshalled.guid.should == @message.guid end it 'marshals the author' do - @marshalled.person.should == @message.person + @marshalled.author.should == @message.author end it 'marshals the diaspora_handle' do @marshalled.diaspora_handle.should == @message.diaspora_handle diff --git a/spec/models/user/attack_vectors_spec.rb b/spec/models/user/attack_vectors_spec.rb index d40d7d23b4d8fffc5d3fd04de16832d4b03931e5..de2bfb50de7210a87000915d9e9cba46e4eaaeea 100644 --- a/spec/models/user/attack_vectors_spec.rb +++ b/spec/models/user/attack_vectors_spec.rb @@ -67,7 +67,7 @@ describe "attack vectors" do zord = Postzord::Receiver.new(user, :salmon_xml => salmon_xml) zord.perform - malicious_message = Factory.build( :status_message, :id => original_message.id, :message => 'BAD!!!', :person => user3.person) + malicious_message = Factory.build(:status_message, :id => original_message.id, :message => 'BAD!!!', :author => user3.person) salmon_xml = user3.salmon(malicious_message).xml_for(user.person) zord = Postzord::Receiver.new(user, :salmon_xml => salmon_xml) zord.perform @@ -83,7 +83,7 @@ describe "attack vectors" do zord.perform lambda { - malicious_message = Factory.build( :status_message, :id => original_message.id, :message => 'BAD!!!', :person => user2.person) + malicious_message = Factory.build( :status_message, :id => original_message.id, :message => 'BAD!!!', :author => user2.person) salmon_xml2 = user3.salmon(malicious_message).xml_for(user.person) zord = Postzord::Receiver.new(user, :salmon_xml => salmon_xml) diff --git a/spec/models/user/querying_spec.rb b/spec/models/user/querying_spec.rb index da876409c00634deb1a8a7314759ff85ee7bbffe..bce6037c459f0c64ef854b50d7ccd34b33f2a16f 100644 --- a/spec/models/user/querying_spec.rb +++ b/spec/models/user/querying_spec.rb @@ -47,7 +47,7 @@ describe User do describe "#visible_posts" do it "queries by person id" do - query = @user2.visible_posts(:person_id => @user2.person.id) + query = @user2.visible_posts(:author_id => @user2.person.id) query.include?(@status_message1).should == true query.include?(@status_message2).should == true query.include?(@status_message3).should == false @@ -195,7 +195,7 @@ describe User do end it 'returns nil if the input is nil' do - @user.contact_for(nil).should be_nil + @user.contact_for(nil).should be_nil end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 078107eef1e76d880c0c157481c0d29a902f7e94..41008ef544585e6ff877cbbd76862f1f544a173f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -271,7 +271,7 @@ describe User do fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', fixture_filename) image = File.open(fixture_name) @photo = Photo.diaspora_initialize( - :person => alice.person, :user_file => image) + :author => alice.person, :user_file => image) @photo.save! @params = {:photo => @photo} end