diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index c7313f41d96..eb8bb2581d8 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -208,7 +208,7 @@ class ListController < ApplicationController topic_query = TopicQuery.new(current_user, options) if current_user.present? - periods = [best_period_for(current_user.last_seen_at)] + periods = [best_period_for(current_user.previous_visit_at)] else periods = TopTopic.periods end @@ -219,6 +219,7 @@ class ListController < ApplicationController end def best_period_for(date) + date ||= 1.year.ago return :yearly if date < 180.days.ago return :monthly if date < 35.days.ago return :weekly if date < 8.days.ago diff --git a/app/models/user.rb b/app/models/user.rb index 7f7780d051d..6868e1a203c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -607,8 +607,7 @@ class User < ActiveRecord::Base private def previous_visit_at_update_required?(timestamp) - seen_before? && - (last_seen_at < (timestamp - SiteSetting.previous_visit_timeout_hours.hours)) + seen_before? && last_seen_at < (timestamp - SiteSetting.previous_visit_timeout_hours.hours) end def update_previous_visit(timestamp) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index df7ab778063..e7207fab2c0 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1127,7 +1127,7 @@ en: today: "Today" other_periods: "dig into other periods" redirect_reasons: - new_user: "Welcome! As a new visitor, we thought you might like to start with this list of the top discussion topics in the last year." + new_user: "Welcome! As a new visitor, we thought you might like to start with this list of the top discussion topics." not_seen_in_a_month: "Welcome back! We haven't seen you in a while. These are the top discussion topics since you've been away." browser_update: 'Unfortunately, your browser is too old to work on this Discourse forum. Please upgrade your browser.'