remove logging statement in a before filter that performed a query
This commit is contained in:
parent
63c7634f6a
commit
eaa191515e
2 changed files with 47 additions and 53 deletions
|
|
@ -4,28 +4,35 @@
|
|||
|
||||
class ApplicationController < ActionController::Base
|
||||
has_mobile_fu
|
||||
|
||||
protect_from_forgery :except => :receive
|
||||
|
||||
before_filter :ensure_http_referer_is_set
|
||||
before_filter :set_header_data, :except => [:create, :update]
|
||||
before_filter :set_header_data, :except => [:create, :update, :destroy]
|
||||
before_filter :set_locale
|
||||
before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision])
|
||||
before_filter :which_action_and_user
|
||||
prepend_before_filter :clear_gc_stats
|
||||
before_filter :set_grammatical_gender
|
||||
|
||||
prepend_before_filter :clear_gc_stats
|
||||
|
||||
inflection_method :grammatical_gender => :gender
|
||||
|
||||
helper_method :all_aspects, :all_contacts_count, :my_contacts_count, :only_sharing_count
|
||||
helper_method :tags, :tag_followings
|
||||
helper_method :all_aspects,
|
||||
:all_contacts_count,
|
||||
:my_contacts_count,
|
||||
:only_sharing_count,
|
||||
:tag_followings,
|
||||
:tags
|
||||
|
||||
def ensure_http_referer_is_set
|
||||
request.env['HTTP_REFERER'] ||= '/aspects'
|
||||
end
|
||||
|
||||
# we need to do this for vanna controller. these should really be controller
|
||||
# helper methods instead
|
||||
def set_header_data
|
||||
if user_signed_in?
|
||||
if request.format.html? && !params[:only_posts]
|
||||
@aspect = nil
|
||||
@notification_count = Notification.for(current_user, :unread =>true).count
|
||||
@unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
|
||||
end
|
||||
|
|
@ -69,18 +76,6 @@ class ApplicationController < ActionController::Base
|
|||
headers['X-Git-Revision'] = AppConfig[:git_revision]
|
||||
end
|
||||
|
||||
def which_action_and_user
|
||||
str = "event=request_with_user controller=#{self.class} action=#{self.action_name} "
|
||||
if current_user
|
||||
str << "uid=#{current_user.id} "
|
||||
str << "user_created_at='#{current_user.created_at.to_date.to_s}' user_created_at_unix=#{current_user.created_at.to_i} " if current_user.created_at
|
||||
str << "user_non_pending_contact_count=#{current_user.contacts.size} user_contact_count=#{Contact.unscoped.where(:user_id => current_user.id).size} "
|
||||
else
|
||||
str << 'uid=nil'
|
||||
end
|
||||
Rails.logger.info str
|
||||
end
|
||||
|
||||
def set_locale
|
||||
if user_signed_in?
|
||||
I18n.locale = current_user.language
|
||||
|
|
|
|||
|
|
@ -21,47 +21,46 @@
|
|||
= form_tag(people_path, :method => 'get', :class => "search_form") do
|
||||
= text_field_tag 'q', nil, :placeholder => t('find_people'), :type => 'search', :results => 5
|
||||
|
||||
- if @notification_count
|
||||
#nav_badges
|
||||
#home_badge.badge
|
||||
= link_to aspects_path, :title => t('_home') do
|
||||
= image_tag 'icons/home_grey.svg', :height => 16
|
||||
#nav_badges
|
||||
#home_badge.badge
|
||||
= link_to aspects_path, :title => t('_home') do
|
||||
= image_tag 'icons/home_grey.svg', :height => 16
|
||||
|
||||
#contacts_badge.badge
|
||||
= link_to contacts_link, :title => t('_contacts') do
|
||||
= image_tag 'icons/contacts_grey.svg', :height => 16
|
||||
#contacts_badge.badge
|
||||
= link_to contacts_link, :title => t('_contacts') do
|
||||
= image_tag 'icons/contacts_grey.svg', :height => 16
|
||||
|
||||
#notification_badge.badge
|
||||
= link_to notifications_path, :title => new_notification_text(@notification_count) do
|
||||
= image_tag 'icons/notifications_grey.svg', :height => 16, :id => "notification-flag"
|
||||
.badge_count{:class => ("hidden" if @notification_count == 0)}
|
||||
= @notification_count
|
||||
#notification_badge.badge
|
||||
= link_to notifications_path, :title => new_notification_text(@notification_count) do
|
||||
= image_tag 'icons/notifications_grey.svg', :height => 16, :id => "notification-flag"
|
||||
.badge_count{:class => ("hidden" if @notification_count == 0)}
|
||||
= @notification_count
|
||||
|
||||
#message_inbox_badge.badge
|
||||
= link_to conversations_path , :title => new_message_text(@unread_message_count) do
|
||||
= image_tag 'icons/mail_grey.svg', :width => 18
|
||||
.badge_count{:class => ("hidden" if @unread_message_count == 0)}
|
||||
= @unread_message_count
|
||||
#message_inbox_badge.badge
|
||||
= link_to conversations_path , :title => new_message_text(@unread_message_count) do
|
||||
= image_tag 'icons/mail_grey.svg', :width => 18
|
||||
.badge_count{:class => ("hidden" if @unread_message_count == 0)}
|
||||
= @unread_message_count
|
||||
|
||||
#notification_dropdown
|
||||
.header
|
||||
= link_to t('.view_all'), notifications_path, :id => "view_all_notifications"
|
||||
%h4
|
||||
= t('.recent_notifications')
|
||||
.notifications
|
||||
.ajax_loader
|
||||
= image_tag("ajax-loader.gif")
|
||||
#notification_dropdown
|
||||
.header
|
||||
= link_to t('.view_all'), notifications_path, :id => "view_all_notifications"
|
||||
%h4
|
||||
= t('.recent_notifications')
|
||||
.notifications
|
||||
.ajax_loader
|
||||
= image_tag("ajax-loader.gif")
|
||||
|
||||
#hovercard_container
|
||||
#hovercard
|
||||
%img.avatar
|
||||
%h4
|
||||
%a.person
|
||||
#hovercard_dropdown_container
|
||||
#hovercard_container
|
||||
#hovercard
|
||||
%img.avatar
|
||||
%h4
|
||||
%a.person
|
||||
#hovercard_dropdown_container
|
||||
|
||||
.hovercard_footer
|
||||
.footer_container
|
||||
.hashtags
|
||||
.hovercard_footer
|
||||
.footer_container
|
||||
.hashtags
|
||||
|
||||
#lightbox
|
||||
#lightbox-content
|
||||
|
|
|
|||
Loading…
Reference in a new issue