# “Top”排序始终默认为“年”时间段

**URL:** https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348
**Category:** Support
**Created:** [2019年六月3日 05:31 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348 "2019-06-03T05:31:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![P16](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@P16](https://meta.discourse.org/u/P16)
#### Post date: [2019年六月3日 05:31 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348/1 "2019-06-03T05:31:19Z")

</div>

I’m not sure if this is a bug, but whenever I visit /Top, the time period selected by default is always the past year. From what I have read on Meta, it should select the time period based on your last visit - i.e. if you haven’t visited Meta in a few days, it shows the past week; likewise, if you visited it yesterday, you should be shown the Top posts for the past 24 hours.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年六月3日 17:41 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348/2 "2019-06-03T17:41:53Z")

</div>

Possibly but I am not sure we did this on manual navigation to top, it is more of a redirect for long absent users. Perhaps @zogstrip can advise.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019年六月4日 08:58 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348/4 "2019-06-04T08:58:11Z")

</div>

Turns out, this was broken since we added support for a default top timeframe. That value was overriding the date of the user’s previous visit instead of just being a default value when there was no previous visit (new user or anon).

[https://github.com/discourse/discourse/commit/33bc8c276d8db36513adf72a863db3d648613489](https://github.com/discourse/discourse/commit/33bc8c276d8db36513adf72a863db3d648613489)

While at it, I noticed another bug where a returning user would not be redirected to the proper timeframe due to a variable not being named properly on the client-side… 🤦‍♂️

[https://github.com/discourse/discourse/commit/b792db9d92dedd5bcd9386f4169fb6c4ee1b55aa](https://github.com/discourse/discourse/commit/b792db9d92dedd5bcd9386f4169fb6c4ee1b55aa)

Thanks @P16 for the report as we got to fix 2 bugs 🙌

---

<div class="post-metadata">

### Author: ![P16](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@P16](https://meta.discourse.org/u/P16)
#### Post date: [2019年六月4日 09:46 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348/5 "2019-06-04T09:46:48Z")

</div>

Thanks @zogstrip for fixing this! Just to confirm, is the correct behavior to default to the most relevant time period, even if /top is selected manually?

While on this topic, are you still open to suggestions for the Top sorting criteria, as the original topic has closed:

> [@Improving the "Top" criteria](https://meta.discourse.org/t/improving-the-top-criteria/26064):
>
> The top page in Discourse is intended for two cases It is where new users are directed after they join the site, and where existing users are directed after long absences from the site. The idea is that we show people the “greatest hits” of the community when they arrive, whether it is the last year, or the last month. When you want to catch up with a busy Discourse and skim just the most interesting / useful / active topics. Sort of like the summarize topic option, but at the topic list l…

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019年六月4日 09:47 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348/6 "2019-06-04T09:47:50Z")

</div>

> [@P16](#):
>
> is the correct behavior to default to the most relevant time period, even if /top is selected manually?

Yes, that is correct.

> [@P16](#):
>
> are you still open to suggestions for the Top sorting criteria, as the original topic has closed:

Sure, I’ve re-opened the topic.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2019年六月4日 16:00 UTC](https://meta.discourse.org/t/top-sorting-always-defaults-to-year-time-period/119348/7 "2019-06-04T16:00:15Z")

</div>

This topic was automatically closed after 7 hours. New replies are no longer allowed.
