诡异的追踪事件 👻

以下是我几个月来一直注意到的一些问题,但从未提交过报告,因为我始终无法稳定复现它们。但终于,在一次偶然中,我成功将其录了下来!(所以请原谅视频中因暂停和困惑而显得混乱的光标移动。)

需要注意的问题有:

  1. “未读”列表为空
  2. Contribute > Feature 显示为“普通”(尽管在我的偏好设置中已被跟踪),只有在刷新后才显示为“已跟踪”
  3. 某个主题莫名其妙地出现在未读列表中(来自几天前、来自 howto 分类)

第二点与我经常看到的一个常见 bug 有些相似(但我从未能在视频中复现它):当我点击我正在跟踪的分类中“新”列表里的一个主题时,该主题的状态不会显示为“已跟踪”,除非我刷新页面。(我怀疑这是否与这一点有关。)

在录制这段视频之前,我正试图通过跟踪 Contribute > Bug,然后从“未读”标签页中点击其中一个主题来复现那个 bug。我没有成功,但在取消跟踪 Contribute > Bug 后,我的“未读”标签页中突然出现了大约 20 个来自 2015 年左右、Contribute > Bug 分类下的已关闭主题,这似乎与第三点提到的 bug 相同。

我不明白为什么会发生这种情况。 :ghost:

2 个赞

What are the repro steps?

1 个赞

There are two bugs here.

I can’t consistently reproduce the first, where the correct notification level is only shown after a refresh (of a category, or a topic). It’s been happening to me for months, but whenever I try to reproduce it, it doesn’t happen.

The second, which I think is a bit more minor, but still a nuisance can be reproduced (for a limited time only) like so:

  1. Clear /unread
  2. Track a category currently set to ‘Normal’
  3. Go back to /unread and observe posts not previously in it

I’ve been able to do this with a number of categories, but only once for each. Once I’ve dismissed the posts from unread, they never appear again.

Consistently reproducing it takes a little more work, so hold onto your hats, it’s gonna get a bit crazy:

  • Go to unread in a category of your choosing which has a notification level of “Normal”, observe nothing there:

  • List all the currently tracked topics in that category (and remember, or take a screenshot of them):

  • Enter a topic from that category not on that list:

  • Start tracking the category
  • Again list tracked topics in that category
  • Observe the topic you just opened in that list:

  • Go to unread, and again observe that topic in the list:


TL;DR

So, the bug here is that previously opened topics in a category become tracked, and appear in unread (unless previously dismissed), when the category is tracked, whereas nothing happens to old not-opened-before topics.

To me, what should happen is either:

  • Nothing changes about the notification status of old topics in a category when it becomes tracked, previously opened or not.

or

  • All old topics become tracked when the category is tracked, but are automatically dismissed, so only new activity appears in the unread tab.

I lean towards the second solution, provided explicitly set notification levels on topics are kept.

I haven’t investigated how this works with other notification levels, I imagine its the same, but I feel it would confuse things for the time being.

So in relation to

What part is considered as “not working as expected”?

1 个赞

两个部分:

第一部分是主题没有被正确地进行隐式跟踪。如果它们被正确跟踪,那么 Community Building > Praise 中的所有主题都应该出现在这一步骤中:

看起来该列表仅显示具有“已跟踪”跟踪记录的主题,而这正是未按预期工作的地方。正确的做法应该是显示所有具有“已跟踪”跟踪记录的主题,以及所有属于已跟踪类别的主题。(对于关注也是如此。)

此外,虽然以下说法是有道理的:

但似乎在用户跟踪类别时,同样的功能缺失了。当主题中出现新帖子时,是否也应该创建跟踪记录?

第二部分是当你跟踪一个类别时,未读列表中会出现看似任意的主题(我假设这是将过去主题的状态从普通更改为已跟踪的副作用),这可以通过自动将这些主题从“未读”中移除来解决。

What are your Preferences → Other
Consider topics new when
and
Automatically track topics I enter
settings?

I haven’t viewed them yet

never

1 个赞

这个问题是我之前发现的,相关讨论帖可以在这里找到(我不太确定为什么它从 Contribute > Bug 板块移到了 Contribute > Feature 板块)。

这个讨论帖有点令人困惑,因为我最初以为这个问题是由从 phpBB 导入数据引起的。所以这里尝试总结一下:

归根结底,一个主题不能同时处于 new(新)和 unread(未读)状态:

  • 尽管它被隐式追踪,但由于用户从未查看过该主题,它不会显示在 unread(未读)中
  • 主题不会显示在 new(新)中,因为它超过了你的“将主题视为新的时间范围”设置所设定的阈值

解决这个问题很难,因为让板块中的每一个旧主题都出现在你的“未读”标签页中,用户体验确实不好。

“自动标记为已读”在数据库层面开销很大(因为你刚刚追踪的板块中的每个主题都需要创建一个新的 TopicUser 记录)。

我们确实没有想出什么整洁的解决方案,讨论也就此沉寂。@sam 提出的一个选项是

当时,我认为这可能是一个好主意:

TL;DR:我没有解决方案,但希望这能让问题更清晰 :wink:

3 个赞

And for the other issue in this thread:

I can reproduce this consistently here on meta for categories. Repro steps:

  1. Go to your user preferences, remove all tracked categories
  2. Go to a category page, e.g. #meta, and observe that the ‘notification level’ indicator is “normal”
  3. Go immediately to your user preferences, by clicking your avatar in the top right, then the cog
  4. Add the category you just visited, e.g. #meta, to your “tracking” categories
  5. Press “save changes”
  6. Press the back button in your browser to return to #meta, and observe that the ‘notification level’ indicator is still “normal”
  7. Refresh the page, and observe that the ‘notification level’ is now “tracked”

If you replace step 6 with visiting the category page by some other route, the tracking status appears correctly.

5 个赞

From a practical perspective, that doesn’t make sense to me. If I buy a book and put it on my shelf having not opened it, it is both new and unread.

Wouldn’t it be possible to have an old topic (with no tracking record) only appear in unread when there’s new activity on it?

So, just as a tracking record is created on new activity for topics in watched categories, a tracking record would be created on new activity for topics in tracked categories.

Combined with the above, couldn’t we just dismiss topics where the tracking record has been changed to “tracking” as a result of tracking the category, which would mean the same user experience, without any additional database writes? (If I understand how tracking records, dismissing and TopicUser relate.)

This way, it seems to me, we could have a mailing list experience for tracking too! :smile:

Sure, I agree. I was talking purely about how it currently works in discourse.

I believe @sam thought this would have major performance issues

I’m 99% sure a new record isn’t created for tracked topics - @sam said “created when we notify users”, and tracking doesn’t cause notifications. Maybe fixing this is the solution :slight_smile:

1 个赞

Do you know if there’s an architectural issue which means the new/unread either/or has to be the case?

Indeed, I was proposing this as a solution which seems to not have any major performance issues.

1 个赞

I assume it’s by design - having a topic listed on the new tab and the unread tab would be a bit weird.

Taking your book analogy, while it can be both unread and new, you can’t put it on your “new” shelf and your “unread” shelf simultaneously :wink:

4 个赞

Ok… I’ve done some testing in my dev environment. As a simplest possible repro:

  1. Set previous visit timeout hours site setting to 0, to make testing quicker
  • User A sets “Consider topics new when” to “created since I was last here”
  • User A sets Category1 to tracked
  • User B posts in Category1
  • User A observes the topic in ‘new’, but does not open it
  • User A leaves the site
  • User A comes back to the site later, and User B’s post is gone from the ‘new’ tab
  • User B posts again in the same topic
  • The topic does not appear in either ‘new’ or ‘unread’ for User A, even though they are tracking the topic

That same repro works for ‘watching’ a category as well. A notification is sent, but no TopicUser row is created (checked on the rails console). It seems that this:

is not happening for some reason, both for watched and tracked categories.

1 个赞

Would it though? We already have topics listed in the latest tab and the new/unread tabs simultaneously. And the two (new and unread) are for different purposes: new is “show me the newest topics on this site” and unread is “show me topics I’ve expressed an interest in, but haven’t (finished) read(ing)”. For new to achieve its purpose it has to have unread topics in it which are new, and for unread to achieve its purpose it needs to have new topics in it which are unread.

Currently the unread tab is rather dysfunctional.

Interesting, thanks for doing all this investigation! So it would seem like if this did actually happen (or more specifically, a TopicUser row was created on topic update, rather than notification, to include tracked categories), then our problems here would be solved. @sam thoughts?

I am fine to change the semantics of “tracked category” so it means, if a category is tracked it will unconditionally show up in new regardless of your new duration, it does not mean this now.

4 个赞