链接行为不一致

尚无法确定这是由于插件(Assign)还是主题组件(Custom Header Links)引起的,但鉴于两者均为官方出品,我决定各打五十大板,将此问题归类为 #contribute:bug。

新实例仅安装了这两个组件。之所以需要 Custom Header Links,是因为 Assign 似乎没有为「分配给我」、「分配给所有人」等选项添加顶部菜单链接。

首次点击这两个链接中的任何一个时,它们会显示正确的已分配帖子。但如果先点击另一个链接,或者重复点击同一个链接,URL 就会从 /latest?assigned=me/latest?assigned=* 变为 /latest,从而导致返回错误的帖子。

因此,从 / 页面点击「我的任务」后,会跳转到 /latest?assigned=me;接着点击「所有任务」时,本应跳转到 /latest?assigned=*,却跳转到了 /latest。此外,如果我已经处于这两个页面中的任意一个,再次点击相应的链接也会被重定向到 /latest

v2.3.0.beta5 +200

Can you give your custom header links settings please ?

Sure, they’re:

My Tasks,My Tasks,/latest?assigned=me,vdm,self

and

All Tasks,All Tasks,/latest?assigned=*,vdm,self
1 个赞

Ok looked at it a little bit, I can say for sure it’s not related “Custom Header links” theme component.

You could for example reproduce multiple times when clicking on the assigned tag under a topic:

The issue is probably in Discourse itself, I feel like discourse-assign is generating the correct URL, will dig more later.

1 个赞

I ended up doing two commits:

https://github.com/discourse/discourse-custom-header-links/commit/bfda9d3b50bd8e027024b62aa0b7e68611248073

https://github.com/discourse/discourse-assign/commit/046f1db466d3f6e01a41217c8593001dc66b21ce

This will now make a full reload but will avoid losing query params

6 个赞

This commit:

https://github.com/discourse/discourse-custom-header-links/commit/175a027582eac0b95803b3675ea37faf527ae68c

Reintroduces this bug:

It’s not just clicking the same link where the issue presents. Clicking between links with querystrings is fundamentally broken by this change too.

If I click the link for ‘Assigned to Me’ latest?assigned=me and follow it with a click to ‘All Tasks’ latest?assigned=* it instead takes me to /latest.

The alternative, reloading the page, seems like a small inconvenience in comparison.

2 个赞