Skip to content
Extraits de code Groupes Projets
Valider ed50fe7f rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

Aspect.people -> Aspect.contacts. Fixed diaspora.en to reflect friend -> contact changes.

parent aa9966ea
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 86 ajouts et 93 suppressions
......@@ -9,7 +9,7 @@ class AspectsController < ApplicationController
respond_to :json, :only => :show
def index
@posts = current_user.visible_posts(:by_members_of => :all).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
@posts = current_user.visible_posts(:by_members_of => :all).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
@aspect = :all
if current_user.getting_started == true
......@@ -50,8 +50,8 @@ class AspectsController < ApplicationController
unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else
@contacts = @aspect.contacts
@posts = current_user.visible_posts( :by_members_of => @aspect ).paginate :per_page => 15, :order => 'created_at DESC'
@aspect_contacts = @aspect.contacts
@posts = current_user.visible_posts( :by_members_of => @aspect ).paginate :per_page => 15, :order => 'created_at DESC'
respond_with @aspect
end
end
......
......@@ -8,7 +8,7 @@ module AspectsHelper
end
def remove_link( aspect )
if aspect.people.size == 0
if aspect.contacts.size == 0
link_to I18n.t('aspects.helper.remove'), aspect, :method => :delete, :confirm => I18n.t('aspects.helper.are_you_sure')
else
"<span class='grey' title=#{I18n.t('aspects.helper.aspect_not_empty')}>#{I18n.t('aspects.helper.remove')}</span>"
......
......@@ -9,7 +9,7 @@ class Aspect
key :request_ids, Array
key :post_ids, Array
many :people, :foreign_key => 'aspect_ids', :class_name => 'Contact'
many :contacts, :foreign_key => 'aspect_ids', :class_name => 'Contact'
many :requests, :in => :request_ids, :class_name => 'Request'
many :posts, :in => :post_ids, :class_name => 'Post'
......
......@@ -90,7 +90,7 @@ class User
######### Aspects ######################
def drop_aspect(aspect)
if aspect.people.size == 0
if aspect.contacts.count == 0
aspect.destroy
else
raise "Aspect not empty"
......@@ -114,7 +114,7 @@ class User
contact = contact_for(Person.find(person_id))
raise "Can not add person to an aspect you do not own" unless aspect = self.aspects.find_by_id(aspect_id)
raise "Can not add person you are not connected to" unless contact
raise 'Can not add person who is already in the aspect' if aspect.people.include?(contact)
raise 'Can not add person who is already in the aspect' if aspect.contacts.include?(contact)
contact.aspects << aspect
opts[:posts] ||= self.raw_visible_posts.all(:person_id => person_id)
......@@ -223,7 +223,7 @@ class User
aspects.each { |aspect|
aspect.posts << post
aspect.save
target_contacts = target_contacts | aspect.people
target_contacts = target_contacts | aspect.contacts
}
push_to_hub(post) if post.respond_to?(:public) && post.public
......
......@@ -3,12 +3,12 @@
-# the COPYRIGHT file.
.span-4.append-1.last
= render 'shared/aspect_contacts', :people => @contacts, :aspect => @aspect
= render 'shared/aspect_contacts', :contacts => @contacts, :aspect => @aspect
.span-15.last
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
= render 'shared/publisher', :aspect => @aspect
= render 'aspects/no_posts_message', :post_count => @posts.count, :contact_cont => @contacts.count
= render 'aspects/no_posts_message', :post_count => @posts.count, :contact_count => @contacts.count
= render 'shared/stream', :posts => @posts
......
......@@ -45,21 +45,17 @@
%li!= remove_link(aspect)
%ul.dropzone{:data=>{:aspect_id=>aspect.id}}
-for contact in aspect.people
-person = contact.person
%li.person{:data=>{:guid=>person.id, :aspect_id=>aspect.id}}
-for contact in aspect.contacts
%li.person{:data=>{:guid=>contact.person.id, :aspect_id=>aspect.id}}
.delete
.x
X
.circle
= person_image_tag(person)
= person_image_tag(contact.person)
.draggable_info
=t('.drag_to_add')
.fancybox_content
%div{:id => "manage_aspect_contacts_pane_#{aspect.id}"}
= render "requests/manage_aspect_contacts", :aspect => aspect, :manage => true
......@@ -3,12 +3,12 @@
-# the COPYRIGHT file.
.span-4.append-1.last
= render 'shared/aspect_contacts', :people => @contacts, :aspect => @aspect
= render 'shared/aspect_contacts', :contacts => @aspect_contacts, :aspect => @aspect
.span-15.last
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts.count
= render 'shared/publisher', :aspect => @aspect
= render 'aspects/no_posts_message', :post_count => @posts.count, :contact_count=> @contacts.count
= render 'aspects/no_posts_message', :post_count => @posts.count, :contact_count=> @aspect_contacts.count
= render 'shared/stream', :posts => @posts
......
......@@ -20,7 +20,7 @@
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle
%p
= label_tag :destination_handle, t('.contacts_username'), :for => "request_d_handle_to_#{aspect.id}"
= label_tag :destination_handle, t('.contact_username'), :for => "request_d_handle_to_#{aspect.id}"
= text_field_tag :destination_handle,'', :id => "request_d_handle_to_#{aspect.id}"
= hidden_field_tag :aspect_id, aspect.id
......
......@@ -9,8 +9,8 @@
.contact_pictures
= owner_image_link
- for contact in people
= person_image_link(contact)
- for contact in contacts
= person_image_link(contact.person)
-unless (aspect == :all)
= link_to (image_tag('add_contact_button.png', :title => "manage #{@aspect}")), "#manage_aspect_contacts_pane", :class => 'manage_aspect_contacts_button'
......
......@@ -28,7 +28,6 @@
%ul
- for contact in contacts
%li
- unless contact.aspect_ids.include?(aspect.id)
= form_tag '/aspects/add_to_aspect' do
= person_image_tag contact.person
......@@ -36,11 +35,10 @@
= contact.person.real_name
.right
= hidden_field_tag :aspect_id, aspect.id
= hidden_field_tag :contact_id, contact.person.id
= hidden_field_tag :person_id, contact.person.id
- if defined?(manage) && manage
= hidden_field_tag :manage, true
= submit_tag '+', :class => 'add', :title => "Add #{contact.person.real_name} to #{aspect}"
- else
= form_tag '/aspects/remove_from_aspect' do
= person_image_tag contact.person
......@@ -48,7 +46,7 @@
= contact.person.real_name
.right
= hidden_field_tag :aspect_id, aspect.id
= hidden_field_tag :contact_id, contact.person.id
= hidden_field_tag :person_id, contact.person.id
- if defined?(manage) && manage
= hidden_field_tag :manage, true
= submit_tag 'x', :class => 'remove', :title => "Remove #{contact.person.real_name} from #{aspect}"
......
%h4
= t('.invites')
= link_to t('.invite_a_contact'), "#invite_user_pane", :class => "invite_user_button", :title => "Invite a contact"
= link_to t('.invite_someone'), "#invite_user_pane", :class => "invite_user_button", :title => "Invite someone"
= t('.invitations_left', :count => invites)
%br
.yo{ :style => "display:none;"}
......
......@@ -19,10 +19,10 @@
%li{:style=>"position:relative;"}
= aspect
.contact_pictures.horizontal
- for contact in aspect.person_objects
= person_image_link(contact)
- for contact in aspect.contacts
= person_image_link(contact.person)
= link_to (image_tag('add_contact_button.png', :title => t('shared.aspect_contactss.add_to', :aspect => aspect))), '#manage_aspect_contacts_pane', :class => 'manage_aspect_contacts_button'
= link_to (image_tag('add_contact_button.png', :title => t('shared.aspect_contacts.add_to', :aspect => aspect))), '#manage_aspect_contacts_pane', :class => 'manage_aspect_contacts_button'
.fancybox_content
#manage_aspect_contacts_pane
......
......@@ -72,13 +72,13 @@ en:
share_with_all: "Share with all aspects"
share_with: "Share with %{aspect}"
all: "all"
aspect_friends:
add_friends: "add friends"
aspect_contacts:
add_contacts: "add contacts"
everyone: "Everyone"
add_to: "add to %{aspect}"
invitations:
invites: "Invites"
invite_a_friend: "Invite a friend"
invite_someone: "Invite someone"
invitations_left: "(%{count} left)"
reshare:
reshare: "Reshare"
......@@ -94,17 +94,17 @@ en:
notification:
new: "New %{type} from %{from}"
aspects:
no_friends_message:
nobody: "We know you have friends bring them to Diaspora!"
no_contacts_message:
nobody: "We know you know people bring them to Diaspora!"
nobody_in_aspect: "Your aspect '%{aspect_name}' is empty."
add_friend: "Add a friend"
add_friend_to: "Add someone to %{aspect_name}"
add_contact: "Add a contact"
add_contact_to: "Add someone to %{aspect_name}"
invite: "Invite someone to join Diaspora!"
no_posts_message:
start_talking: "Nobody has said anything yet. Get the conversation started!"
manage:
add_a_new_aspect: "Add a new aspect"
add_a_new_friend: "Add a new friend"
add_a_new_contact: "Add a new contact"
requests: "Requests"
no_requests: "No new requests"
manage_aspects: "Manage aspects"
......@@ -120,13 +120,13 @@ en:
success: "%{name} was successfully removed."
update:
success: "Your aspect, %{name}, has been successfully edited."
move_friend:
move_contact:
failure: "didn't work %{inspect}"
success: "Person moved to new aspect"
error: "Error moving friend: %{inspect}"
error: "Error moving contact: %{inspect}"
add_to_aspect:
failure: "Failed to add friend to aspect."
success: "Successfully added friend to aspect."
failure: "Failed to add contact to aspect."
success: "Successfully added contact to aspect."
helper:
remove: "remove"
aspect_not_empty: "Aspect not empty"
......@@ -136,7 +136,7 @@ en:
failure: "Failed to remove person from aspect"
users:
edit:
invite_friends: "Invite friends"
invite_contacts: "Invite contacts"
export_data: "Export Data"
close_account: "Close Account"
change_language: "Change Language"
......@@ -157,7 +157,7 @@ en:
your_profile: "Your Profile"
step_2:
your_aspects: "Your aspects"
description: "Tell Diaspora what different aspects of you are seen by different friends. You can manage these later by clicking the manage tab on the top right. Your aspects are unique to you, and not visible by others."
description: "Tell Diaspora what different aspects of you are seen by different contacts. You can manage these later by clicking the manage tab on the top right. Your aspects are unique to you, and not visible by others."
aspect_name: "Aspect name"
add: "Add"
step_3:
......@@ -254,7 +254,7 @@ en:
pending_request: "pending request"
already_friends: "Already friends"
thats_you: "thats you!"
add_friend: "add friend"
add_contact: "add contact"
index:
results_for: "search results for"
show:
......@@ -281,7 +281,7 @@ en:
updated: "Profile updated"
failed: "Failed to update profile"
profile_sidebar:
remove_friend: "remove friend"
remove_contact: "remove contact"
edit_my_profile: "Edit my profile"
last_seen: "last seen: %{how_long_ago}"
bio: "bio"
......@@ -292,15 +292,15 @@ en:
people_on_pod_are_aware_of: " people on pod are aware of"
requests:
manage_aspect_contacts:
add_a_new_friend_to: "Add a new friend to"
add_a_new_contact_to: "Add a new contact to"
enter_a_diaspora_username: "Enter a Diaspora username:"
your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}"
friends_username: "Friend's username"
contact_username: "Contact's username"
create_request: "Create request"
destroy:
success: "You are now friends."
error: "Please select an aspect!"
ignore: "Ignored friend request."
ignore: "Ignored contact request."
create:
tried: "we tried our best to send a message to %{account}"
services:
......@@ -322,13 +322,13 @@ en:
love: "love,"
diaspora: "the diaspora email robot"
new_request:
subject: "new Diaspora* friend request from %{from}"
just_sent_you: "just sent you a friend request on Diaspora*"
subject: "new Diaspora* contact request from %{from}"
just_sent_you: "just sent you a contact request on Diaspora*"
try_it_out: "You should really think about checking it out."
sign_in: "sign in here"
request_accepted:
subject: "%{name} has accepted your friend request on Diaspora*"
accepted: "has accepted your friend request. They are now in your"
subject: "%{name} has accepted your contact request on Diaspora*"
accepted: "has accepted your contact request. They are now in your"
aspect: "aspect."
date:
order: [:month, :day, :year]
......@@ -57,7 +57,7 @@ module Diaspora
end
def people_in_aspects(aspects)
person_ids = contacts_in_aspects(aspects).collect{|x| x.person_id}
person_ids = contacts_in_aspects(aspects).collect{|contact| contact.person_id}
Person.all(:id.in => person_ids)
end
......@@ -76,7 +76,7 @@ module Diaspora
def contacts_in_aspects aspects
aspects.inject([]) do |contacts,aspect|
contacts | aspect.people
contacts | aspect.contacts
end
end
......
Fichier déplacé
......@@ -116,20 +116,20 @@ describe AspectsController do
describe "#add_to_aspect" do
it 'adds the users to the aspect' do
@aspect1.reload
@aspect1.people.include?(@contact).should be false
@aspect1.contacts.include?(@contact).should be false
post 'add_to_aspect', {:person_id => @user2.person.id, :aspect_id => @aspect1.id}
@aspect1.reload
@aspect1.people.include?(@contact).should be true
@aspect1.contacts.include?(@contact).should be true
end
end
describe "#remove_from_aspect" do
it 'adds the users to the aspect' do
@aspect.reload
@aspect.people.include?(@contact).should be true
@aspect.contacts.include?(@contact).should be true
post 'remove_from_aspect', {:person_id => @user2.person.id, :aspect_id => @aspect1.id}
@aspect1.reload
@aspect1.people.include?(@contact).should be false
@aspect1.contacts.include?(@contact).should be false
end
end
end
......@@ -65,7 +65,7 @@ describe Diaspora::Parser do
user.reload
aspect.reload
new_contact = user.contact_for(user2.person)
aspect.people.include?(new_contact).should be true
aspect.contacts.include?(new_contact).should be true
user.contacts.include?(new_contact).should be true
end
......@@ -75,7 +75,7 @@ describe Diaspora::Parser do
retraction_xml = retraction.to_diaspora_xml
lambda { user.receive retraction_xml, user2.person }.should change {
aspect.reload.people.size }.by(-1)
aspect.reload.contacts.size }.by(-1)
end
it 'should marshal a profile for a person' do
......
......@@ -57,7 +57,7 @@ describe 'making sure the spec runner works' do
contact = @user1.contact_for @user2.person
contact.should_not be_nil
@user1.contacts.include?(contact).should be_true
@aspect1.people.include?(contact).should be_true
@aspect1.contacts.include?(contact).should be_true
contact.aspects.include?( @aspect1 ).should be true
end
......@@ -65,7 +65,7 @@ describe 'making sure the spec runner works' do
contact = @user2.contact_for @user1.person
contact.should_not be_nil
@user2.contacts.include?(contact).should be_true
@aspect2.people.include?(contact).should be_true
@aspect2.contacts.include?(contact).should be_true
contact.aspects.include?( @aspect2 ).should be true
end
......
......@@ -35,22 +35,22 @@ describe Aspect do
end
it 'should not be creatable with people' do
aspect = user.aspects.create(:name => 'losers', :people => [connected_person, connected_person_2])
aspect.people.size.should == 0
aspect = user.aspects.create(:name => 'losers', :contacts => [connected_person, connected_person_2])
aspect.contacts.size.should == 0
end
it 'should be able to have other users' do
Contact.create(:user => user, :person => user2.person, :aspects => [aspect])
aspect.people.first(:person_id => user.person.id).should be_nil
aspect.people.first(:person_id => user2.person.id).should_not be_nil
aspect.people.size.should == 1
aspect.contacts.first(:person_id => user.person.id).should be_nil
aspect.contacts.first(:person_id => user2.person.id).should_not be_nil
aspect.contacts.size.should == 1
end
it 'should be able to have users and people' do
contact1 = Contact.create(:user => user, :person => user2.person, :aspects => [aspect])
contact2 = Contact.create(:user => user, :person => connected_person_2, :aspects => [aspect])
aspect.people.include?(contact1).should be_true
aspect.people.include?(contact2).should be_true
aspect.contacts.include?(contact1).should be_true
aspect.contacts.include?(contact2).should be_true
aspect.save.should be_true
end
end
......@@ -81,9 +81,8 @@ describe Aspect do
user.aspects.should == [aspect]
end
it 'should have people' do
aspect.people.first(:person_id => connected_person.id).should be_true
aspect.people.size.should == 1
it 'should have contacts' do
aspect.contacts.size.should == 1
end
describe '#aspects_with_person' do
......@@ -101,7 +100,7 @@ describe Aspect do
aspects = user.aspects_with_person(connected_person)
aspects.count.should == 2
contact = user.contact_for(connected_person)
aspects.each{ |asp| asp.people.include?(contact).should be_true }
aspects.each{ |asp| asp.contacts.include?(contact).should be_true }
aspects.include?(aspect_without_contact).should be_false
end
end
......@@ -110,7 +109,7 @@ describe Aspect do
describe 'posting' do
it 'should add post to aspect via post method' do
aspect = user.aspects.create(:name => 'losers', :people => [connected_person])
aspect = user.aspects.create(:name => 'losers', :contacts => [connected_person])
status_message = user.post( :status_message, :message => "hey", :to => aspect.id )
......@@ -157,17 +156,17 @@ describe Aspect do
describe "#add_person_to_aspect" do
it 'adds the user to the aspect' do
aspect1.people.include?(contact).should be_false
aspect1.contacts.include?(contact).should be_false
user.add_person_to_aspect(user2.person.id, aspect1.id)
aspect1.reload
aspect1.people.include?(contact).should be_true
aspect1.contacts.include?(contact).should be_true
end
it 'raises if its an aspect that the user does not own'do
proc{user.add_person_to_aspect(user2.person.id, aspect2.id) }.should raise_error /Can not add person to an aspect you do not own/
end
it 'does not allow to have duplicate people in an aspect' do
it 'does not allow to have duplicate contacts in an aspect' do
proc{user.add_person_to_aspect(not_contact.id, aspect1.id) }.should raise_error /Can not add person you are not connected to/
end
......@@ -180,10 +179,10 @@ describe Aspect do
it 'deletes a user from the aspect' do
user.add_person_to_aspect(user2.person.id, aspect1.id)
user.reload
aspect1.reload.people.include?(contact).should be true
aspect1.reload.contacts.include?(contact).should be true
user.delete_person_from_aspect(user2.person.id, aspect1.id)
user.reload
aspect1.reload.people.include?(contact).should be false
aspect1.reload.contacts.include?(contact).should be false
end
it 'should check to make sure you have the aspect ' do
......@@ -229,24 +228,24 @@ describe Aspect do
aspect.reload
aspect1.reload
aspect.people.include?(contact).should be_false
aspect1.people.include?(contact).should be_true
aspect.contacts.include?(contact).should be_false
aspect1.contacts.include?(contact).should be_true
end
it "should not move a person who is not a contact" do
proc{ user.move_contact(:person_id => connected_person.id, :from => aspect.id, :to => aspect1.id) }.should raise_error /Can not add person you are not connected to/
aspect.reload
aspect1.reload
aspect.people.first(:person_id => connected_person.id).should be_nil
aspect1.people.first(:person_id => connected_person.id).should be_nil
aspect.contacts.first(:person_id => connected_person.id).should be_nil
aspect1.contacts.first(:person_id => connected_person.id).should be_nil
end
it "should not move a person to a aspect that's not his" do
proc {user.move_contact(:person_id => user2.person.id, :from => aspect.id, :to => aspect2.id )}.should raise_error /Can not add person to an aspect you do not own/
aspect.reload
aspect2.reload
aspect.people.include?(contact).should be true
aspect2.people.include?(contact).should be false
aspect.contacts.include?(contact).should be true
aspect2.contacts.include?(contact).should be false
end
it 'should move all posts by that user to the new aspect' do
......
......@@ -215,23 +215,23 @@ describe Diaspora::UserModules::Connecting do
lambda {
user2.disconnect user.person }.should change {
user2.reload.contacts.count }.by(-1)
aspect2.reload.people.count.should == 0
aspect2.reload.contacts.count.should == 0
end
it 'is disconnected by another user' do
lambda { user.disconnected_by user2.person }.should change {
user.contacts.count }.by(-1)
aspect.reload.people.count.should == 0
aspect.reload.contacts.count.should == 0
end
it 'should remove the contact from all aspects they are in' do
user.add_person_to_aspect(user2.person.id, aspect1.id)
aspect.reload.people.count.should == 1
aspect1.reload.people.count.should == 1
aspect.reload.contacts.count.should == 1
aspect1.reload.contacts.count.should == 1
lambda { user.disconnected_by user2.person }.should change {
user.contacts.count }.by(-1)
aspect.reload.people.count.should == 0
aspect1.reload.people.count.should == 0
aspect.reload.contacts.count.should == 0
aspect1.reload.contacts.count.should == 0
end
context 'with a post' 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