Skip to content

Commit 8b240b6

Browse files
committed
Remove useless cell methods, sidebar_for_node_recent_topics cache key use node_id.
1 parent cf2e083 commit 8b240b6

File tree

4 files changed

+2
-58
lines changed

4 files changed

+2
-58
lines changed

app/cells/topics/high_likes_topics.html.erb

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/cells/topics/high_replies_topics.html.erb

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/cells/topics_cell.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def sidebar_suggest_topics
3838
end
3939

4040
# 节点下面的最新话题
41-
cache :sidebar_for_node_recent_topics, :expires_in => 20.minutes do |cell, args|
42-
args[:topic].id
41+
cache :sidebar_for_node_recent_topics, :expires_in => 30.minutes do |cell, args|
42+
['node',args[:topic].node_id].join("-")
4343
end
4444
def sidebar_for_node_recent_topics(args = {})
4545
topic = args[:topic]
@@ -60,18 +60,6 @@ def index_locations
6060
render
6161
end
6262

63-
cache :high_likes_topics, :expires_in => 3.hours
64-
def high_likes_topics
65-
@topics = Topic.by_week.high_likes.limit(10)
66-
render
67-
end
68-
69-
cache :high_replies_topics, :expires_in => 3.hours
70-
def high_replies_topics
71-
@topics = Topic.by_week.high_replies.limit(10)
72-
render
73-
end
74-
7563
def tips
7664
@tip = ""
7765
if !SiteConfig.tips.blank?

spec/cells/topics_cell_spec.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,6 @@
5050
end
5151
end
5252

53-
describe "high topics" do
54-
before(:each) do
55-
t1 = Factory(:topic)
56-
t2 = Factory(:topic)
57-
t3 = Factory(:topic)
58-
end
59-
60-
it "should render high_likes_topics" do
61-
count = Topic.by_week.count
62-
count = 10 if count > 10
63-
render_cell(:topics, :high_likes_topics).should have_css('div.high_likes_topics li', :count => count)
64-
end
65-
66-
it "should render high_replies_topics" do
67-
count = Topic.by_week.count
68-
count = 10 if count > 10
69-
render_cell(:topics, :high_replies_topics).should have_css('div.high_replies_topics li', :count => count)
70-
end
71-
end
72-
7353
describe "sidebar_for_node_recent_topics" do
7454
let(:node) { Factory(:node) }
7555
let(:topic0) { Factory(:topic, :node => node) }

0 commit comments

Comments
 (0)