From 1fa2dfd6eb146d2a0d128c995335d26112478616 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 8 Jul 2010 12:05:06 -0700 Subject: [PATCH] DG MS cleaning up friend request --- app/controllers/application_controller.rb | 2 +- app/controllers/people_controller.rb | 2 +- app/controllers/person_requests_controller.rb | 2 +- app/models/person.rb | 2 +- app/views/friends/_sidebar.html.haml | 5 ---- app/views/friends/index.html.haml | 19 ------------- app/views/friends/new.html.haml | 27 ------------------- app/views/friends/show.html.haml | 24 ----------------- app/views/layouts/application.html.haml | 4 +-- app/views/people/_sidebar.html.haml | 2 +- lib/common.rb | 3 --- spec/controllers/dashboard_controller_spec.rb | 2 +- spec/lib/parser_spec.rb | 1 - 13 files changed, 8 insertions(+), 87 deletions(-) delete mode 100644 app/views/friends/_sidebar.html.haml delete mode 100644 app/views/friends/index.html.haml delete mode 100644 app/views/friends/new.html.haml delete mode 100644 app/views/friends/show.html.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e22044141..d86938c05 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base end def set_people - @people = Person.all + @people = Person.friends.all end end diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 24c556c46..f55f9d0f9 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -2,7 +2,7 @@ class PeopleController < ApplicationController before_filter :authenticate_user! def index - @people = Person.paginate :page => params[:page], :order => 'created_at DESC' + @people = Person.friends.paginate :page => params[:page], :order => 'created_at DESC' end def show diff --git a/app/controllers/person_requests_controller.rb b/app/controllers/person_requests_controller.rb index 4dba011d0..dfe23cd49 100644 --- a/app/controllers/person_requests_controller.rb +++ b/app/controllers/person_requests_controller.rb @@ -26,7 +26,7 @@ class PersonRequestsController < ApplicationController def create @person_request = PersonRequest.for(params[:person_request][:url]) - if true + if @person_request flash[:notice] = "Successfully created person request." redirect_to @person_request else diff --git a/app/models/person.rb b/app/models/person.rb index 843486ad4..06b1c691c 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -22,7 +22,7 @@ class Person #validates_uniqueness_of :url validates_true_for :url, :logic => lambda { self.url_unique?} - + scope :friends, where(:_type => "Person") validates_presence_of :email before_validation :clean_url diff --git a/app/views/friends/_sidebar.html.haml b/app/views/friends/_sidebar.html.haml deleted file mode 100644 index 6ef5d9073..000000000 --- a/app/views/friends/_sidebar.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h3 your friends -%ul#friend_stream.nav - - for friend in @friends - %li= link_to friend.real_name, friend_path(friend) -/= link_to "add a new friend", new_friend_path diff --git a/app/views/friends/index.html.haml b/app/views/friends/index.html.haml deleted file mode 100644 index cda1e225b..000000000 --- a/app/views/friends/index.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -- title "Friends" - -%table - %tr - %th real name - %th email - %th url - - for friend in @friends - %tr - %td= friend.real_name - %td= friend.email - %td= friend.url - %td= link_to 'Show', friend - %td= link_to 'Destroy', friend, :confirm => 'Are you sure?', :method => :delete - -%p= link_to "New Friend", new_friend_path - -#pagination - = will_paginate @friends diff --git a/app/views/friends/new.html.haml b/app/views/friends/new.html.haml deleted file mode 100644 index f18335484..000000000 --- a/app/views/friends/new.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -- title "New Friend" - -= form_for @friend do |f| - = f.error_messages - %p - = f.label :email - %br - = f.text_field :email - %p - = f.label :url - %br - = f.text_field :url - - =f.fields_for :profile do |p| - %p - = p.label :first_name - %br - = p.text_field :first_name - - %p - = p.label :last_name - %br - = p.text_field :last_name - = f.submit - - -%p= link_to "Back to List", friends_path diff --git a/app/views/friends/show.html.haml b/app/views/friends/show.html.haml deleted file mode 100644 index 3fdac293b..000000000 --- a/app/views/friends/show.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -.span-18.last - %h1= "#{@friend.real_name}" -- if @friend_profile - %p - %b First Name - %p - = @friend_profile.first_name - %p - %b Last Name - %p - = @friend_profile.last_name - %p - %b url - %p - = @friend.url - -.span-18 - - if @friend.posts - %h3 stream - %ul#stream - - for post in @friend_posts - = render type_partial(post), :post => post - - else - %h3 no posts to display! diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 12a4159e7..bc9bcb039 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -17,7 +17,7 @@ = yield(:head) - /= javascript_include_tag 'satisfaction' , 'satisfaction-display' + = javascript_include_tag 'satisfaction' , 'satisfaction-display' %body %header .container @@ -43,7 +43,7 @@ #content.span-24.last .span-3.append-1.last = link_to owner_picture, root_path - /= render 'friends/sidebar' if user_signed_in? + = render 'people/sidebar' if user_signed_in? .span-20 - if user_signed_in? diff --git a/app/views/people/_sidebar.html.haml b/app/views/people/_sidebar.html.haml index 996401ca7..dd8f68ff6 100644 --- a/app/views/people/_sidebar.html.haml +++ b/app/views/people/_sidebar.html.haml @@ -2,4 +2,4 @@ %ul#friend_stream.nav - for person in @people %li= link_to person.real_name, person_path(person) -/= link_to "add a new friend", new_friend_path += link_to "add a new person", new_person_path diff --git a/lib/common.rb b/lib/common.rb index 0bf3dad82..ca270730b 100644 --- a/lib/common.rb +++ b/lib/common.rb @@ -29,9 +29,6 @@ module Diaspora def store_objects_from_xml(xml) objects = parse_objects_from_xml(xml) - - puts xml - objects.each do |p| if p.is_a? Retraction p.perform diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/dashboard_controller_spec.rb index 97656369e..5efe9047c 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/dashboard_controller_spec.rb @@ -16,7 +16,7 @@ describe DashboardController do it "on index sets a person's variable" do Factory.create :person get :index - assigns[:people].should == Person.all + assigns[:people].should == Person.friends.all end end diff --git a/spec/lib/parser_spec.rb b/spec/lib/parser_spec.rb index fe93b33bb..6499b4c52 100644 --- a/spec/lib/parser_spec.rb +++ b/spec/lib/parser_spec.rb @@ -121,7 +121,6 @@ describe "parser in application helper" do Person.count.should be 0 store_objects_from_xml(xml) Person.count.should be 1 - puts Person.first.inspect end it "should activate the Person if I initiated a request to that url" do