DG MS; don't fetch people or contact objects (you don't need) on multi stream.
This commit is contained in:
parent
028817541e
commit
c133c16dc2
2 changed files with 6 additions and 11 deletions
|
|
@ -242,7 +242,6 @@ class User < ActiveRecord::Base
|
|||
|
||||
def update_post(post, post_hash={})
|
||||
if self.owns? post
|
||||
puts 'ownin'
|
||||
post.update_attributes(post_hash)
|
||||
self.dispatch_post(post)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ module Diaspora
|
|||
def visible_ids_from_sql(klass, opts={})
|
||||
opts = prep_opts(klass, opts)
|
||||
opts[:klass] = klass
|
||||
opts[:by_members_of] ||= self.aspects.map{|a| a.id}
|
||||
opts[:by_members_of] ||= self.aspect_ids
|
||||
|
||||
post_ids = klass.connection.select_values(visible_shareable_sql(klass, opts)).map { |id| id.to_i }
|
||||
post_ids += klass.connection.select_values(construct_public_followings_sql(opts).to_sql).map {|id| id.to_i }
|
||||
|
|
@ -244,7 +244,7 @@ module Diaspora
|
|||
|
||||
def construct_public_followings_sql(opts)
|
||||
aspects = Aspect.where(:id => opts[:by_members_of])
|
||||
person_ids = Person.connection.select_values(people_in_aspects(aspects).select("id").to_sql)
|
||||
person_ids = Person.connection.select_values(people_in_aspects(aspects).select("people.id").to_sql)
|
||||
|
||||
query = opts[:klass].where(:author_id => person_ids, :public => true, :pending => false)
|
||||
|
||||
|
|
@ -290,8 +290,10 @@ module Diaspora
|
|||
|
||||
def people_in_aspects(requested_aspects, opts={})
|
||||
allowed_aspects = self.aspects & requested_aspects
|
||||
person_ids = contacts_in_aspects(allowed_aspects).collect{|contact| contact.person_id}
|
||||
people = Person.where(:id => person_ids)
|
||||
aspect_ids = allowed_aspects.map(&:id)
|
||||
|
||||
people = Person.joins(:contacts => {:aspect_memberships => :aspect}).
|
||||
where(Aspect.arel_table[:id].in(aspect_ids))
|
||||
|
||||
if opts[:type] == 'remote'
|
||||
people = people.where(:owner_id => nil)
|
||||
|
|
@ -305,12 +307,6 @@ module Diaspora
|
|||
contact_for(person).aspects
|
||||
end
|
||||
|
||||
def contacts_in_aspects aspects
|
||||
aspect_ids = aspects.map{|a| a.id}
|
||||
Contact.joins(:aspect_memberships => :aspect).
|
||||
where(Aspect.arel_table[:id].in(aspect_ids))
|
||||
end
|
||||
|
||||
def posts_from(person)
|
||||
EvilQuery::ShareablesFromPerson.new(self, Post, person).make_relation!
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue