BUGFIX: use previous_visit_at instead of last_seen_at to determine the best period to display in the top summary
This commit is contained in:
parent
462c6d81f5
commit
c1a66b70bb
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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, <a href="http://www.discourse.org/faq/#browser">your browser is too old to work on this Discourse forum</a>. Please <a href="http://browsehappy.com">upgrade your browser</a>.'
|
||||
|
|
Loading…
Reference in New Issue