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
|
class ApplicationController < ActionController::Base
|
||||||
has_mobile_fu
|
has_mobile_fu
|
||||||
|
|
||||||
protect_from_forgery :except => :receive
|
protect_from_forgery :except => :receive
|
||||||
|
|
||||||
before_filter :ensure_http_referer_is_set
|
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_locale
|
||||||
before_filter :set_git_header if (AppConfig[:git_update] && AppConfig[:git_revision])
|
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
|
before_filter :set_grammatical_gender
|
||||||
|
|
||||||
|
prepend_before_filter :clear_gc_stats
|
||||||
|
|
||||||
inflection_method :grammatical_gender => :gender
|
inflection_method :grammatical_gender => :gender
|
||||||
|
|
||||||
helper_method :all_aspects, :all_contacts_count, :my_contacts_count, :only_sharing_count
|
helper_method :all_aspects,
|
||||||
helper_method :tags, :tag_followings
|
:all_contacts_count,
|
||||||
|
:my_contacts_count,
|
||||||
|
:only_sharing_count,
|
||||||
|
:tag_followings,
|
||||||
|
:tags
|
||||||
|
|
||||||
def ensure_http_referer_is_set
|
def ensure_http_referer_is_set
|
||||||
request.env['HTTP_REFERER'] ||= '/aspects'
|
request.env['HTTP_REFERER'] ||= '/aspects'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# we need to do this for vanna controller. these should really be controller
|
||||||
|
# helper methods instead
|
||||||
def set_header_data
|
def set_header_data
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
if request.format.html? && !params[:only_posts]
|
if request.format.html? && !params[:only_posts]
|
||||||
@aspect = nil
|
|
||||||
@notification_count = Notification.for(current_user, :unread =>true).count
|
@notification_count = Notification.for(current_user, :unread =>true).count
|
||||||
@unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
|
@unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
|
||||||
end
|
end
|
||||||
|
|
@ -69,18 +76,6 @@ class ApplicationController < ActionController::Base
|
||||||
headers['X-Git-Revision'] = AppConfig[:git_revision]
|
headers['X-Git-Revision'] = AppConfig[:git_revision]
|
||||||
end
|
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
|
def set_locale
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
I18n.locale = current_user.language
|
I18n.locale = current_user.language
|
||||||
|
|
|
||||||
|
|
@ -21,47 +21,46 @@
|
||||||
= form_tag(people_path, :method => 'get', :class => "search_form") do
|
= form_tag(people_path, :method => 'get', :class => "search_form") do
|
||||||
= text_field_tag 'q', nil, :placeholder => t('find_people'), :type => 'search', :results => 5
|
= text_field_tag 'q', nil, :placeholder => t('find_people'), :type => 'search', :results => 5
|
||||||
|
|
||||||
- if @notification_count
|
#nav_badges
|
||||||
#nav_badges
|
#home_badge.badge
|
||||||
#home_badge.badge
|
= link_to aspects_path, :title => t('_home') do
|
||||||
= link_to aspects_path, :title => t('_home') do
|
= image_tag 'icons/home_grey.svg', :height => 16
|
||||||
= image_tag 'icons/home_grey.svg', :height => 16
|
|
||||||
|
|
||||||
#contacts_badge.badge
|
#contacts_badge.badge
|
||||||
= link_to contacts_link, :title => t('_contacts') do
|
= link_to contacts_link, :title => t('_contacts') do
|
||||||
= image_tag 'icons/contacts_grey.svg', :height => 16
|
= image_tag 'icons/contacts_grey.svg', :height => 16
|
||||||
|
|
||||||
#notification_badge.badge
|
#notification_badge.badge
|
||||||
= link_to notifications_path, :title => new_notification_text(@notification_count) do
|
= link_to notifications_path, :title => new_notification_text(@notification_count) do
|
||||||
= image_tag 'icons/notifications_grey.svg', :height => 16, :id => "notification-flag"
|
= image_tag 'icons/notifications_grey.svg', :height => 16, :id => "notification-flag"
|
||||||
.badge_count{:class => ("hidden" if @notification_count == 0)}
|
.badge_count{:class => ("hidden" if @notification_count == 0)}
|
||||||
= @notification_count
|
= @notification_count
|
||||||
|
|
||||||
#message_inbox_badge.badge
|
#message_inbox_badge.badge
|
||||||
= link_to conversations_path , :title => new_message_text(@unread_message_count) do
|
= link_to conversations_path , :title => new_message_text(@unread_message_count) do
|
||||||
= image_tag 'icons/mail_grey.svg', :width => 18
|
= image_tag 'icons/mail_grey.svg', :width => 18
|
||||||
.badge_count{:class => ("hidden" if @unread_message_count == 0)}
|
.badge_count{:class => ("hidden" if @unread_message_count == 0)}
|
||||||
= @unread_message_count
|
= @unread_message_count
|
||||||
|
|
||||||
#notification_dropdown
|
#notification_dropdown
|
||||||
.header
|
.header
|
||||||
= link_to t('.view_all'), notifications_path, :id => "view_all_notifications"
|
= link_to t('.view_all'), notifications_path, :id => "view_all_notifications"
|
||||||
%h4
|
%h4
|
||||||
= t('.recent_notifications')
|
= t('.recent_notifications')
|
||||||
.notifications
|
.notifications
|
||||||
.ajax_loader
|
.ajax_loader
|
||||||
= image_tag("ajax-loader.gif")
|
= image_tag("ajax-loader.gif")
|
||||||
|
|
||||||
#hovercard_container
|
#hovercard_container
|
||||||
#hovercard
|
#hovercard
|
||||||
%img.avatar
|
%img.avatar
|
||||||
%h4
|
%h4
|
||||||
%a.person
|
%a.person
|
||||||
#hovercard_dropdown_container
|
#hovercard_dropdown_container
|
||||||
|
|
||||||
.hovercard_footer
|
.hovercard_footer
|
||||||
.footer_container
|
.footer_container
|
||||||
.hashtags
|
.hashtags
|
||||||
|
|
||||||
#lightbox
|
#lightbox
|
||||||
#lightbox-content
|
#lightbox-content
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue