diff --git a/Gemfile.lock b/Gemfile.lock index d8ae98214..323329257 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,7 +68,6 @@ GEM Platform (>= 0.4.0) open4 Platform (0.4.0) - SystemTimer (1.2.1) abstract (1.0.0) actionmailer (3.0.3) actionpack (= 3.0.3) @@ -97,6 +96,7 @@ GEM activesupport (= 3.0.3) activesupport (3.0.3) addressable (2.2.2) + archive-tar-minitar (0.5.2) arel (2.0.9) aws (2.3.32) activesupport @@ -123,7 +123,6 @@ GEM selenium-webdriver (>= 0.0.3) carrierwave (0.5.2) activesupport (~> 3.0) - cgi_multipart_eof_fix (2.5.0) chalofa_ruby-progressbar (0.0.9.1) chef (0.9.12) bunny (>= 0.6.0) @@ -182,7 +181,6 @@ GEM faraday_middleware (0.3.2) faraday (~> 0.5.4) fastercsv (1.5.4) - fastthread (1.0.7) ffi (0.6.3) rake (>= 0.8.7) fixture_builder (0.2.2) @@ -201,7 +199,6 @@ GEM chalofa_ruby-progressbar (~> 0.0.9) rspec (~> 2.0) rspec-instafail (~> 0.1.4) - gem_plugin (0.2.3) gherkin (2.3.8) json (>= 1.4.6) haml (3.0.25) @@ -223,7 +220,8 @@ GEM launchy (0.4.0) configuration (>= 0.0.5) rake (>= 0.8.1) - linecache (0.43) + linecache19 (0.5.12) + ruby_core_source (>= 0.1.4) mail (2.2.19) activesupport (>= 2.3.6) i18n (>= 0.4.0) @@ -238,11 +236,6 @@ GEM mixlib-config (1.1.2) mixlib-log (1.3.0) moneta (0.6.0) - mongrel (1.1.5) - cgi_multipart_eof_fix (>= 2.4) - daemons (>= 1.0.3) - fastthread (>= 1.0.1) - gem_plugin (>= 0.2.3) multi_json (0.0.5) multi_xml (0.2.2) multipart-post (1.1.1) @@ -321,7 +314,7 @@ GEM activesupport (= 3.0.3) rake (>= 0.8.7) thor (~> 0.14.4) - rake (0.8.7) + rake (0.9.0) rcov (0.9.9) redis (2.2.0) redis-namespace (0.8.0) @@ -347,15 +340,20 @@ GEM activesupport (~> 3.0) railties (~> 3.0) rspec (~> 2.6.0) - ruby-debug (0.10.4) - columnize (>= 0.1) - ruby-debug-base (~> 0.10.4.0) - ruby-debug-base (0.10.4) - linecache (>= 0.3) + ruby-debug-base19 (0.11.25) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby_core_source (>= 0.1.4) + ruby-debug19 (0.11.6) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby-debug-base19 (>= 0.11.19) ruby-hmac (0.4.0) ruby-openid (2.1.8) ruby-openid-apps-discovery (1.2.0) ruby-openid (>= 2.1.7) + ruby_core_source (0.1.5) + archive-tar-minitar (>= 0.5.2) rubyntlm (0.1.1) rubyzip (0.9.4) selenium-client (1.2.18) @@ -402,7 +400,6 @@ PLATFORMS ruby DEPENDENCIES - SystemTimer (= 1.2.1) acts-as-taggable-on! addressable (= 2.2.2) aws (= 2.3.32) @@ -433,7 +430,6 @@ DEPENDENCIES json (= 1.4.6) launchy mini_magick (= 3.2) - mongrel mysql2 (= 0.2.6) nokogiri ohai (= 0.5.8) @@ -446,7 +442,7 @@ DEPENDENCIES rspec (>= 2.0.0) rspec-instafail (>= 0.1.7) rspec-rails (>= 2.0.0) - ruby-debug + ruby-debug19 selenium-webdriver (= 0.1.3) sod! thin (= 1.2.11) diff --git a/Rakefile b/Rakefile index 3166e3126..9cacf875e 100644 --- a/Rakefile +++ b/Rakefile @@ -9,4 +9,11 @@ require File.expand_path('../config/application', __FILE__) require 'rake' require 'resque/tasks' +# for rake 0.9.0 +module Diaspora + class Application + include Rake::DSL + end +end + Diaspora::Application.load_tasks diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index f3fbab9bb..69f8e7e5d 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -5,37 +5,6 @@ class ContactsController < ApplicationController before_filter :authenticate_user! - def new - @person = Person.find(params[:person_id]) - @aspects_with_person = [] - @aspects_without_person = current_user.aspects - @contact = Contact.new - render :layout => false - end - - def edit - @contact = current_user.contacts.unscoped.find(params[:id]) - @person = @contact.person - - @all_aspects ||= current_user.aspects - @aspects_with_person = @contact.aspects || [] - - @aspects_without_person = @all_aspects - @aspects_with_person - - render :layout => false - end - - def destroy - contact = current_user.contacts.find(params[:id]) - - if current_user.disconnect(contact) - flash[:notice] = I18n.t('contacts.destroy.success', :name => contact.person.name) - else - flash[:error] = I18n.t('contacts.destroy.failure', :name => contact.person.name) - end - redirect_to contact.person - end - def sharing @contacts = current_user.contacts.sharing.includes(:aspect_memberships) render :layout => false diff --git a/app/views/contacts/_aspect_dropdown.html.haml b/app/views/aspect_memberships/_aspect_dropdown.html.haml similarity index 100% rename from app/views/contacts/_aspect_dropdown.html.haml rename to app/views/aspect_memberships/_aspect_dropdown.html.haml diff --git a/app/views/contacts/_aspect_dropdown_list_item.haml b/app/views/aspect_memberships/_aspect_dropdown_list_item.haml similarity index 100% rename from app/views/contacts/_aspect_dropdown_list_item.haml rename to app/views/aspect_memberships/_aspect_dropdown_list_item.haml diff --git a/app/views/aspects/create.js.erb b/app/views/aspects/create.js.erb index a5ddd04e7..76cbe43bc 100644 --- a/app/views/aspects/create.js.erb +++ b/app/views/aspects/create.js.erb @@ -2,7 +2,7 @@ // licensed under the Affero General Public License version 3 or later. See // the COPYRIGHT file. -$('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('contacts/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>"); +$('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('aspect_memberships/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>"); ContactEdit.updateNumber("<%= @person.id %>"); $.facebox.close(); diff --git a/app/views/contacts/_share_with_list.html.haml b/app/views/contacts/_share_with_list.html.haml deleted file mode 100644 index 442225ece..000000000 --- a/app/views/contacts/_share_with_list.html.haml +++ /dev/null @@ -1,35 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - -.aspect_list#aspects_list{:data=> {:contact_id=> (contact ? contact.id : nil)}} - %ul - - for aspect in aspects_with_person - = render :partial => 'aspects/aspect_list_item', - :locals => {:aspect => aspect, :person => person, - :contact => contact} - - - for aspect in aspects_without_person - = render :partial => 'aspects/aspect_list_item', - :locals => {:aspect => aspect, :person => person, - :contact => contact} -.add_aspect - = form_for(Aspect.new, :remote => true) do |aspect| - = aspect.error_messages - = aspect.hidden_field :person_id, :value => person.id if person - = aspect.hidden_field :contact_id, :value => contact.id if contact - = aspect.hidden_field :share_with, :value => true - %p - = aspect.text_field :name, :style => "display:inline;" - %p.checkbox_select - = aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible') - = aspect.check_box :contacts_visible, :checked => true, :default => true - .right - = aspect.submit t('contacts.share_with_pane.add_new_aspect'), :class => 'button' - --unless friend_finder ||= false - .done - .right - = link_to t('aspects.aspect_contacts.done_editing'), "#", :class => "button", :onClick => '$.facebox.close();' - - if contact.persisted? - = link_to t('people.profile_sidebar.remove_contact'), contact, :confirm => t('are_you_sure'), :method => :delete diff --git a/app/views/contacts/_share_with_pane.html.haml b/app/views/contacts/_share_with_pane.html.haml deleted file mode 100644 index 8a839acb4..000000000 --- a/app/views/contacts/_share_with_pane.html.haml +++ /dev/null @@ -1,17 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. -.share_with - #facebox_header - = person_image_link(person, :size => :thumb_small) - %h4 - = t('.share_with', :name => person.name) - - .description - = t('.following', :name => person.first_name) - - = render :partial => 'contacts/share_with_list', - :locals => {:person => person, :contact => contact, - :aspects_with_person => aspects_with_person, - :aspects_without_person => aspects_without_person} - diff --git a/app/views/contacts/edit.html.haml b/app/views/contacts/edit.html.haml deleted file mode 100644 index 0ee3ebdb9..000000000 --- a/app/views/contacts/edit.html.haml +++ /dev/null @@ -1,10 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - -= render :partial => 'share_with_pane', - :locals => {:person => @person, - :contact => @contact, - :aspects_with_person => @aspects_with_person, - :aspects_without_person => @aspects_without_person} - diff --git a/app/views/contacts/new.html.haml b/app/views/contacts/new.html.haml deleted file mode 100644 index 0ee3ebdb9..000000000 --- a/app/views/contacts/new.html.haml +++ /dev/null @@ -1,10 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - -= render :partial => 'share_with_pane', - :locals => {:person => @person, - :contact => @contact, - :aspects_with_person => @aspects_with_person, - :aspects_without_person => @aspects_without_person} - diff --git a/app/views/contacts/sharing.haml b/app/views/contacts/sharing.haml index 29c9dbaae..187c46a21 100644 --- a/app/views/contacts/sharing.haml +++ b/app/views/contacts/sharing.haml @@ -2,9 +2,6 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -/- content_for :head do -/ = include_javascripts :aspects - #aspect_edit_pane #facebox_header .right @@ -26,7 +23,7 @@ = contact.person.diaspora_handle .right - = render 'aspect_dropdown', :contact => contact, :person => contact.person, :hang => 'right' + = render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => contact.person, :hang => 'right' %br %div{:style => "text-align:right;"} diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 07e49ee10..85eb9a170 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -20,7 +20,7 @@ .stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"} - if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note.target) .right - = render 'contacts/aspect_dropdown', :contact => contact, :person => note.target, :hang => 'left' + = render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => note.target, :hang => 'left' %span.from = notification_people_link(note) diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 5cb756855..d6f27d594 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -27,7 +27,7 @@ - if person != current_user.person %hr{:style=>"width:300px;"} %br - = render 'contacts/aspect_dropdown', :contact => @contact, :person => @person, :hang => 'left' + = render 'aspect_memberships/aspect_dropdown', :contact => @contact, :person => @person, :hang => 'left' %br %br -if contact.sharing? || person == current_user.person diff --git a/app/views/people/_relationship_action.haml b/app/views/people/_relationship_action.haml index 5f98c77cd..9f70f9981 100644 --- a/app/views/people/_relationship_action.haml +++ b/app/views/people/_relationship_action.haml @@ -1,6 +1,6 @@ - unless person == current_user.person - contact = current_user.contacts.find_by_person_id(person.id) - contact ||= Contact.new(:person => person) - = render 'contacts/aspect_dropdown', :contact => contact, :person => person, :hang => 'left' + = render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left' -else = t('people.person.thats_you') diff --git a/app/views/services/_remote_friend.html.haml b/app/views/services/_remote_friend.html.haml index 5f1462f72..6775a8113 100644 --- a/app/views/services/_remote_friend.html.haml +++ b/app/views/services/_remote_friend.html.haml @@ -30,14 +30,8 @@ = friend.name - unless friend.person.nil? - / should be dropdown %li{:id => "options_" + friend.uid, :class => "share_with hidden", :style => "height:auto"} - contact = friend.contact - - contact ||= Contact.new - = render :partial => 'contacts/share_with_list', - :locals => {:person => friend.person, - :contact => contact, - :aspects_with_person => [], - :aspects_without_person => current_user.aspects, - :friend_finder => true} + - contact ||= Contact.new(:person => friend.person) + = render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => friend.person, :hang => 'left' diff --git a/app/views/tags/show.haml b/app/views/tags/show.haml index eee1fd762..dd545a56e 100644 --- a/app/views/tags/show.haml +++ b/app/views/tags/show.haml @@ -40,7 +40,7 @@ - contact ||= Contact.new(:person => person) - unless person == current_user.person .right - = render 'contacts/aspect_dropdown', :contact => contact, :person => person, :hang => 'left' + = render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left' .content %span.from diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 9888e9f39..61cbd5a62 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -148,6 +148,14 @@ en: success: "Successfully removed person from aspect" failure: "Failed to remove person from aspect" no_membership: "Could not find the selected person in that aspect" + aspect_dropdown: + add_to_aspect: "Add to aspect" + toggle: + zero: "Add to aspect" + one: "In %{count} aspect" + few: "In %{count} aspects" + many: "In %{count} aspects" + other: "In %{count} aspects" bookmarklet: post_success: "Posted! Closing!" @@ -171,23 +179,8 @@ en: few: "%{count} contacts" many: "%{count} contacts" other: "%{count} contacts" - destroy: - success: "Successfully disconnected from %{name}" - failure: "Failed to disconnect from %{name}" - share_with_pane: - share_with: "Start sharing with %{name}" - following: "By placing %{name} in an aspect, you'll start following and sending posts to them." - add_new_aspect: "add to new aspect" create: failure: "Failed to create contact" - aspect_dropdown: - add_to_aspect: "Add to aspect" - toggle: - zero: "Add to aspect" - one: "In %{count} aspect" - few: "In %{count} aspects" - many: "In %{count} aspects" - other: "In %{count} aspects" sharing: people_sharing: "People sharing with you:" diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index 0d7640e03..8ce8ec501 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -6,61 +6,10 @@ require 'spec_helper' describe ContactsController do before do - @aspect = alice.aspects.first - @contact = alice.contact_for(bob.person) - sign_in :user, alice @controller.stub(:current_user).and_return(alice) end - describe '#new' do - it 'assigns a person' do - get :new, :person_id => bob.person.id - assigns[:person].should == bob.person - end - - it 'assigns aspects without person' do - get :new, :person_id => bob.person.id - assigns[:aspects_without_person].should =~ alice.aspects - end - end - - describe '#edit' do - it 'assigns a contact' do - get :edit, :id => @contact.id - assigns[:contact].should == @contact - end - - it 'assigns a person' do - get :edit, :id => @contact.id - assigns[:person].should == @contact.person - end - end - - describe '#destroy' do - it 'disconnects from the person' do - alice.should_receive(:disconnect).with(@contact) - delete :destroy, :id => @contact.id - end - - it 'flases success if the contact is not destroyed' do - alice.stub!(:disconnect).and_return(true) - delete :destroy, :id => @contact.id - flash[:notice].should_not be_empty - end - - it 'flases failure if the contact is not destroyed' do - alice.stub!(:disconnect).and_return(false) - delete :destroy, :id => @contact.id - flash[:error].should_not be_empty - end - - it 'redirects back to the person page' do - delete :destroy, :id => @contact.id - response.should redirect_to(@contact.person) - end - end - describe '#sharing' do it "succeeds" do get :sharing