mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
add tests for ListController.best_period_for
This commit is contained in:
@ -302,7 +302,7 @@ class ListController < ApplicationController
|
||||
topic_query = TopicQuery.new(current_user, options)
|
||||
|
||||
if current_user.present?
|
||||
periods = [best_period_for(current_user.previous_visit_at)]
|
||||
periods = [ListController.best_period_for(current_user.previous_visit_at)]
|
||||
else
|
||||
periods = TopTopic.periods
|
||||
end
|
||||
@ -312,7 +312,7 @@ class ListController < ApplicationController
|
||||
top
|
||||
end
|
||||
|
||||
def best_period_for(date)
|
||||
def self.best_period_for(date)
|
||||
date ||= 1.year.ago
|
||||
return :yearly if date < 180.days.ago
|
||||
return :monthly if date < 35.days.ago
|
||||
|
Reference in New Issue
Block a user