Conflicts: app/controllers/aspects_controller.rb app/controllers/contacts_controller.rb app/controllers/people_controller.rb app/controllers/photos_controller.rb app/controllers/tags_controller.rb app/helpers/notifications_helper.rb app/models/notifications/new_request.rb app/models/user_preference.rb public/javascripts/view.js spec/controllers/aspects_controller_spec.rb spec/controllers/contacts_controller_spec.rb spec/controllers/home_controller_spec.rb spec/controllers/post_visibilities_controller_spec.rb spec/controllers/requests_controller_spec.rb spec/mailers/notifier_spec.rb spec/models/user_spec.rb
43 lines
1.2 KiB
Ruby
43 lines
1.2 KiB
Ruby
# Copyright (c) 2010, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
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
|
|
render :layout => false
|
|
end
|
|
end
|