Skip to content
Extraits de code Groupes Projets
Valider ff0f37ce rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

eliminate one source of dup pvs

parent 2784f641
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -22,8 +22,8 @@ class StatusMessagesController < ApplicationController
aspects = current_user.aspects_from_ids(params[:aspect_ids])
if @status_message.save
current_user.add_to_streams(@status_message, aspects)
current_user.dispatch_post(@status_message, :url => post_url(@status_message))
current_user.add_to_streams(@status_message, aspects)
if !photos.empty?
@status_message.photos += photos
for photo in photos
......
......@@ -37,9 +37,6 @@ class Post < ActiveRecord::Base
def self.diaspora_initialize params
new_post = self.new params.to_hash
new_post.person = params[:person]
params[:aspect_ids].each do |aspect_id|
new_post.aspects << Aspect.find_by_id(aspect_id)
end if params[:aspect_ids]
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
......
class UniquePostVisibilities < ActiveRecord::Migration
def self.up
remove_index :post_visibilities, [:aspect_id, :post_id]
add_index :post_visibilities, [:aspect_id, :post_id], :unique => true
end
def self.down
remove_index :post_visibilities, [:aspect_id, :post_id]
add_index :post_visibilities, [:aspect_id, :post_id]
end
end
......@@ -351,7 +351,7 @@ ActiveRecord::Schema.define(:version => 20110211021926) do
t.datetime "updated_at"
end
add_index "post_visibilities", ["aspect_id", "post_id"], :name => "index_post_visibilities_on_aspect_id_and_post_id"
add_index "post_visibilities", ["aspect_id", "post_id"], :name => "index_post_visibilities_on_aspect_id_and_post_id", :unique => true
add_index "post_visibilities", ["aspect_id"], :name => "index_post_visibilities_on_aspect_id"
add_index "post_visibilities", ["post_id"], :name => "index_post_visibilities_on_post_id"
......
......@@ -134,14 +134,14 @@ describe 'a user receives a post' do
end
it 'should not override userrefs on receive by another person' do
new_user = Factory(:user)
new_user = Factory(:user_with_aspect)
@status_message.post_visibilities.reset
@status_message.user_refs.should == 3
new_user.activate_contact(@user2.person, @aspect3)
new_user.activate_contact(@user2.person, new_user.aspects.first)
xml = @status_message.to_diaspora_xml
receive_with_zord(new_user, @user2.person, xml)
receive_with_zord(new_user, @user2.person, xml)
@status_message.post_visibilities.reset
@status_message.user_refs.should == 4
......@@ -231,7 +231,7 @@ describe 'a user receives a post' do
describe 'receiving mulitple versions of the same post from a remote pod' do
before 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)
end
......@@ -243,8 +243,8 @@ describe 'a user receives a post' do
sleep(2)
old_time = Time.now
receive_with_zord(@local_leia, @remote_raphael, xml)
(Post.find_by_guid @post.guid).updated_at.should be < old_time
(Post.find_by_guid @post.guid).created_at.should be < old_time
(Post.find_by_guid @post.guid).updated_at.should be < old_time
(Post.find_by_guid @post.guid).created_at.should be < old_time
end
it 'does not update the post if a new one is sent with a new created_at' do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter