Skip to content
Extraits de code Groupes Projets
Valider 71631540 rédigé par Stephan Schulz's avatar Stephan Schulz
Parcourir les fichiers

Limit allowed contacts for sending messages to, to the ones that are sharing with you.

parent 47dbced6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -70,7 +70,7 @@ class ConversationsController < ApplicationController
def new
all_contacts_and_ids = Contact.connection.select_rows(
current_user.contacts.joins(:person => :profile).
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(/(")/, "'")} }
......
......@@ -18,8 +18,10 @@ describe ConversationsController do
response.should be_success
end
it "assigns a json list of contacts" do
assigns(:contacts_json).should include(alice.contacts.first.person.name)
it "assigns a json list of contacts that are sharing with the person" do
assigns(:contacts_json).should include(alice.contacts.where(:sharing => true).first.person.name)
alice.contacts << Contact.new(:person_id => eve.person.id, :user_id => alice.id, :sharing => false, :receiving => true)
assigns(:contacts_json).should_not include(alice.contacts.where(:sharing => false).first.person.name)
end
it "assigns a contact if passed a contact id" 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