parent
dfa0245f4b
commit
2f1193fa36
3 changed files with 8 additions and 6 deletions
|
|
@ -83,8 +83,10 @@ class ConversationsController < ApplicationController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
all_contacts_and_ids = Contact.connection.select_rows(
|
all_contacts_and_ids = Contact.connection.select_rows(
|
||||||
current_user.contacts.where(:sharing => true).joins(:person => :profile).
|
Contact.connection.unprepared_statement {
|
||||||
select("contacts.id, profiles.first_name, profiles.last_name, people.diaspora_handle").to_sql
|
current_user.contacts.where(:sharing => true).joins(:person => :profile).
|
||||||
|
select("contacts.id, profiles.first_name, profiles.last_name, people.diaspora_handle").to_sql
|
||||||
|
}
|
||||||
).map{|r| {:value => r[0], :name => Person.name_from_attrs(r[1], r[2], r[3]).gsub(/(")/, "'")} }
|
).map{|r| {:value => r[0], :name => Person.name_from_attrs(r[1], r[2], r[3]).gsub(/(")/, "'")} }
|
||||||
|
|
||||||
@contact_ids = ""
|
@contact_ids = ""
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ module User::Querying
|
||||||
opts[:klass] = klass
|
opts[:klass] = klass
|
||||||
opts[:by_members_of] ||= self.aspect_ids
|
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(visible_shareable_sql(klass, opts)).map(&:to_i)
|
||||||
post_ids += klass.connection.select_values("#{construct_public_followings_sql(opts).to_sql} LIMIT #{opts[:limit]}").map {|id| id.to_i }
|
post_ids += klass.connection.select_values("#{construct_public_followings_sql(opts).to_sql} LIMIT #{opts[:limit]}").map {|id| id.to_i }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -88,9 +88,9 @@ module User::Querying
|
||||||
end
|
end
|
||||||
|
|
||||||
def construct_shareable_from_self_query(opts)
|
def construct_shareable_from_self_query(opts)
|
||||||
conditions = {:pending => false }
|
conditions = {:pending => false, :author_id => self.person_id }
|
||||||
conditions[:type] = opts[:type] if opts.has_key?(:type)
|
conditions[:type] = opts[:type] if opts.has_key?(:type)
|
||||||
query = self.person.send(opts[:klass].to_s.tableize).where(conditions)
|
query = opts[:klass].where(conditions)
|
||||||
|
|
||||||
if opts[:by_members_of]
|
if opts[:by_members_of]
|
||||||
query = query.joins(:aspect_visibilities).where(:aspect_visibilities => {:aspect_id => opts[:by_members_of]})
|
query = query.joins(:aspect_visibilities).where(:aspect_visibilities => {:aspect_id => opts[:by_members_of]})
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module EvilQuery
|
||||||
end
|
end
|
||||||
|
|
||||||
def id_sql(relation, id_column)
|
def id_sql(relation, id_column)
|
||||||
relation.select(id_column).to_sql
|
@class.connection.unprepared_statement { relation.select(id_column).to_sql }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue