mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 03:21:02 +08:00
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)
|
topic_query = TopicQuery.new(current_user, options)
|
||||||
|
|
||||||
if current_user.present?
|
if current_user.present?
|
||||||
periods = [best_period_for(current_user.last_seen_at)]
|
periods = [best_period_for(current_user.previous_visit_at)]
|
||||||
else
|
else
|
||||||
periods = TopTopic.periods
|
periods = TopTopic.periods
|
||||||
end
|
end
|
||||||
|
@ -219,6 +219,7 @@ class ListController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def best_period_for(date)
|
def best_period_for(date)
|
||||||
|
date ||= 1.year.ago
|
||||||
return :yearly if date < 180.days.ago
|
return :yearly if date < 180.days.ago
|
||||||
return :monthly if date < 35.days.ago
|
return :monthly if date < 35.days.ago
|
||||||
return :weekly if date < 8.days.ago
|
return :weekly if date < 8.days.ago
|
||||||
|
|
|
@ -607,8 +607,7 @@ class User < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def previous_visit_at_update_required?(timestamp)
|
def previous_visit_at_update_required?(timestamp)
|
||||||
seen_before? &&
|
seen_before? && last_seen_at < (timestamp - SiteSetting.previous_visit_timeout_hours.hours)
|
||||||
(last_seen_at < (timestamp - SiteSetting.previous_visit_timeout_hours.hours))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_previous_visit(timestamp)
|
def update_previous_visit(timestamp)
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ en:
|
||||||
today: "Today"
|
today: "Today"
|
||||||
other_periods: "dig into other periods"
|
other_periods: "dig into other periods"
|
||||||
redirect_reasons:
|
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."
|
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>.'
|
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
Block a user