diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f8c99941f737e470cee89591bc6542b6487e15af..fbbfb067f693781487cf0ec85fbbb3119a83b1f8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,10 +23,10 @@ class ApplicationController < ActionController::Base end def set_header_data - if user_signed_in? + if user_signed_in? && request.format.html? @aspect = nil @object_aspect_ids = [] - @all_aspects = current_user.aspects.includes(:aspect_memberships) + @all_aspects = current_user.aspects @notification_count = Notification.for(current_user, :unread =>true).count @unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}") end @@ -98,18 +98,4 @@ class ApplicationController < ActionController::Base def grammatical_gender @grammatical_gender || nil end - - def similar_people contact, opts={} - opts[:limit] ||= 5 - aspect_ids = contact.aspect_ids - count = Contact.count(:user_id => current_user.id, - :person_id.ne => contact.person.id, - :aspect_ids.in => aspect_ids) - - if count > opts[:limit] - offset = rand(count-opts[:limit]) - else - offset = 0 - end - end end diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index e165c3e6563a1da7957db8bc2dd61b6695ac1aed..a567fc8387374b463db33db8a884c2ec04590e21 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -4,7 +4,7 @@ class ContactsController < ApplicationController before_filter :authenticate_user! - + def new @person = Person.find(params[:person_id]) @aspects_with_person = [] @@ -40,6 +40,7 @@ class ContactsController < ApplicationController end def edit + @all_aspects ||= current_user.aspects @contact = Contact.unscoped.where(:id => params[:id], :user_id => current_user.id).first @person = @contact.person @@ -61,7 +62,7 @@ class ContactsController < ApplicationController else flash[:error] = I18n.t('contacts.destroy.failure', :name => contact.person.name) end - redirect_to contact.person + redirect_to contact.person end private diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 9ab1395669266eb3d746f508f2fef49f09626f4d..10c2c10cad1083b8efa82989b8dfa31a2ff130f5 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -3,7 +3,7 @@ # the COPYRIGHT file. class PostsController < ApplicationController - skip_before_filter :set_contacts_notifications_unread_count_and_status + skip_before_filter :set_header_data skip_before_filter :count_requests skip_before_filter :set_invites skip_before_filter :set_locale diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb index 85806c76dcef903fe6a55f1d2af6b305ec33baa3..5fd0105f4947715b3c5cc01d3d53d05d37f934ee 100644 --- a/app/controllers/publics_controller.rb +++ b/app/controllers/publics_controller.rb @@ -6,7 +6,7 @@ class PublicsController < ApplicationController require File.join(Rails.root, '/lib/diaspora/parser') include Diaspora::Parser - skip_before_filter :set_contacts_notifications_unread_count_and_status, :except => [:create, :update] + skip_before_filter :set_header_data skip_before_filter :count_requests skip_before_filter :set_invites skip_before_filter :set_locale