From cf9f952d90aa19d1454260cea91e8354b5a5aa52 Mon Sep 17 00:00:00 2001 From: Yannick Francois Date: Fri, 13 Sep 2013 22:40:20 +0200 Subject: [PATCH] Don't call google search in dashboard if env is dev --- app/controllers/admin/dashboard_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index ae9896f6fc..a9deac7cb4 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -6,11 +6,11 @@ class Admin::DashboardController < Admin::BaseController def index t = Time.new today = t.strftime("%Y-%m-%d 00:00") - + # Since last venue @newposts_count = Article.published_since(current_user.last_venue).count @newcomments_count = Feedback.published_since(current_user.last_venue).count - + # Today @statposts = Article.published.where("published_at > ?", today).count @statsdrafts = Article.drafts.where("created_at > ?", today).count @@ -21,10 +21,10 @@ def index @presumedspam = Comment.presumed_spam.where("created_at > ?", today).count @confirmed = Comment.ham.where("created_at > ?", today).count @unconfirmed = Comment.unconfirmed.where("created_at > ?", today).count - + @comments = Comment.last_published @drafts = Article.drafts.where("user_id = ?", current_user.id).limit(5) - + @statspam = Comment.spam.count @inbound_links = inbound_links @publify_links = publify_dev @@ -55,8 +55,8 @@ def publify_version private def inbound_links - host = URI.parse(this_blog.base_url).host - return [] if (host.downcase == 'localhost' || host =~ /\.local$/) # don't try to fetch links for local blogs + host = URI.parse(this_blog.base_url).host + return [] if Rails.env.development? url = "http://www.google.com/search?q=links:#{host}&tbm=blg&output=rss" parse(url).reverse.compact end