Internal links not oneboxing in private messages

AI-generated summary

The discussion addresses an issue where internal links in private messages fail to onebox, unlike in regular posts. xrav3nz first reported the problem, noting that while internal links onebox correctly in topics, they only display as quotes in private messages. Mittineague suggests this may be due to a fix preventing information leakage from private topics. zogstrip explains that removing the source_topic_id parameter made it difficult to determine if links are within the same topic. sam proposes passing topic and category IDs to maintain proper oneboxing. zogstrip confirms a fix has been implemented, and xrav3nz demonstrates the improvement, though notes some inconsistencies remain. zogstrip confirms the issue is resolved with a recent commit.

I first noticed this from the private messages I received from the “Save Searches” plugin yesterday:

I thought this was simply flaky but the same happened with today’s message.


Internal links seem to onebox fine when linking in a topic/post:

Yet it failed to onebox when I just tried to link it in a private message:

The external link on the bottom worked, in contrast.

6 Likes

Nice catch :wink:

https://github.com/discourse/discourse/commit/8e0da35857f56c5c5938cd5b058277814e075519

8 Likes

IIRC this may have to do with a fix to a leaking problem. i.e. the public topic displayed a link to the message. Clicking the link gave the “oops or private” page, but the title of the message topic and the fact one existed was exposed. eg.

:link: Is this guy a first class numpty or what?

2 Likes

Follow up question: has there been a deliberate change in how a onebox to a internal link that does not belong to the current topic renders?


i.e.

Linking a post in the current topic renders as “quote”: :white_check_mark:

Linking a post that does not belong to the current post used to render as the following:

But currently, also as a quote: (a possible :x:?)

2 Likes

Yeah, since we removed the source_topic_id parameter, there’s no way for the server to know if we’re in the same topic or not anymore…

4 Likes

Oh we should change this so we always use the off topic style if we must, but we can also pass in topic id with category id

4 Likes

Are you saying this will be corrected or there’ll be a new way to link? Linking between topics is something we find very useful.

In fact the only thing I wish it did do that it doesn’t is to display the images in the linked post too.

1 Like

This is something @zogstrip is actively working on; he’ll update in a bit.

6 Likes

There’s now a title when linking to a different topic

https://github.com/discourse/discourse/commit/60ec483caae52db3e067292a22f7bdaae7f879ca

9 Likes

Quick demo/test:

A post in the current topic:

A post from another topic:

tada Thanks @zogstrip for following through with the issue!


What I see in composer preview:

What I see in the post:

Why do I feel like we have gone down some kind of rabbit hole…

2 Likes

I forgot to report back here but I fixed it yesterday

https://github.com/discourse/discourse/commit/0799831dbe9014005a7e62c77c1b38b7d46e7ab7

7 Likes