diff options
-rw-r--r-- | app/controllers/tweets_controller.rb | 14 | ||||
-rw-r--r-- | app/models/tweet.rb | 19 | ||||
-rw-r--r-- | config/routes.rb | 3 |
3 files changed, 0 insertions, 36 deletions
diff --git a/app/controllers/tweets_controller.rb b/app/controllers/tweets_controller.rb index 92043e4..3c6295b 100644 --- a/app/controllers/tweets_controller.rb +++ b/app/controllers/tweets_controller.rb @@ -26,20 +26,6 @@ class TweetsController < ApplicationController @tweets = @user.tweets.reacted.order_by_reactions.list(params, force_page: true) end - def favorited - user_required - check_public! - @caption = "#{@user.screen_name}'s Most Favorited" - @tweets = @user.tweets.reacted.order_by_favorites.list(params, force_page: true, cache: 3.minutes) - end - - def retweeted - user_required - check_public! - @caption = "#{@user.screen_name}'s Most Retweeted" - @tweets = @user.tweets.reacted.order_by_retweets.list(params, force_page: true, cache: 3.minutes) - end - def recent user_required check_public! diff --git a/app/models/tweet.rb b/app/models/tweet.rb index c784612..112fb27 100644 --- a/app/models/tweet.rb +++ b/app/models/tweet.rb @@ -53,10 +53,6 @@ class Tweet < ActiveRecord::Base ret = ret.max_id(params[:max_id]).since_id(params[:since_id]) end - if options[:cache] && options[:cache] > 0 - ret = ret.cache_list(options[:cache]) - end - ret end @@ -166,20 +162,5 @@ class Tweet < ActiveRecord::Base tweets[:text].__send__(positive ? :matches : :does_not_match, "%#{search_text}%") end end - - def self.cache_list(expires_in) - key = "tweets/ids/#{Digest::MD5.hexdigest(current_scope.to_sql)}" - ids = Rails.cache.read(key) - unless ids - ids = current_scope.pluck(:id) - Rails.cache.write(key, ids, expires_in: expires_in) - end - m = unscoped.where(id: ids) - if ids.size > 0 - m.order("CASE tweets.id #{ids.each_with_index.map {|m, i| "WHEN #{m} THEN #{i}" }.join(" ")} END") - else - m - end - end end diff --git a/config/routes.rb b/config/routes.rb index 1671ae0..f2c3b1e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -34,7 +34,6 @@ Aclog::Application.routes.draw do # User pages scope "/:screen_name", controller: "users" do - get "/stats", action: "stats", as: "user_stats" get "/discovered_by", action: "discovered_by", as: "user_discovered_by" get "/discovered_users", action: "discovered_users", as: "user_discovered_users" end @@ -56,8 +55,6 @@ Aclog::Application.routes.draw do scope "/:screen_name" do get "/", action: "index", as: "user" get "/best", action: "best", as: "user_best" - get "/favorited", action: "favorited", as: "user_favorited" - get "/retweeted", action: "retweeted", as: "user_retweeted" get "/recent", action: "recent", as: "user_recent" get "/timeline", action: "timeline", as: "user_timeline" get "/discoveries", action: "discoveries", as: "user_discoveries" |