Mentions in comments (@User) no longer highlighted #14104

Closed
opened 2025-11-02 11:02:55 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @KazzmanK on GitHub (Feb 6, 2025).

Originally assigned to: @wxiaoguang on GitHub.

Description

Previously, mentioned user was rendered as user name and link, now it is not. May be something related to mentions also broken

Screenshots

Image

Image

Gitea Version

1.23.1

Can you reproduce the bug on the Gitea demo site?

No

Operating System

No response

Browser Version

130

Originally created by @KazzmanK on GitHub (Feb 6, 2025). Originally assigned to: @wxiaoguang on GitHub. ### Description Previously, mentioned user was rendered as user name and link, now it is not. May be something related to mentions also broken ### Screenshots ![Image](https://github.com/user-attachments/assets/9cbacc60-e6d6-4d18-95e6-0c88898aa8d3) ![Image](https://github.com/user-attachments/assets/b2e1b85b-df9c-4bc9-a579-36beaa7844c0) ### Gitea Version 1.23.1 ### Can you reproduce the bug on the Gitea demo site? No ### Operating System _No response_ ### Browser Version 130
GiteaMirror added the topic/uitype/bug labels 2025-11-02 11:02:55 -06:00
Author
Owner

@aceArt-GmbH commented on GitHub (Feb 10, 2025):

Same on Version: 1.23.3. Worked without problem in 1.22
Some users still work, others not. I do not see a pattern yet

Even mentioning users that are not autocompleted sometimes work

UPDATE:
changing "User visibility" from private or limited to public fixes the problem.
This still seems like a regression?
Changelog does not not mention anything related

@aceArt-GmbH commented on GitHub (Feb 10, 2025): Same on Version: 1.23.3. Worked without problem in 1.22 Some users still work, others not. I do not see a pattern yet Even mentioning users that are not autocompleted sometimes work UPDATE: changing "User visibility" from private or limited to public fixes the problem. This still seems like a regression? Changelog does not not mention anything related
Author
Owner

@wxiaoguang commented on GitHub (Feb 11, 2025):

UPDATE:
changing "User visibility" from private or limited to public fixes the problem.
This still seems like a regression?
Changelog does not not mention anything related

Thank you very much, it seems to be a root reason. Maybe related to some refactoring changes. Will try to take a look.

@wxiaoguang commented on GitHub (Feb 11, 2025): > UPDATE: > changing "User visibility" from private or limited to public fixes the problem. > This still seems like a regression? > Changelog does not not mention anything related Thank you very much, it seems to be a root reason. Maybe related to some refactoring changes. Will try to take a look.
Author
Owner

@wxiaoguang commented on GitHub (Feb 11, 2025):

I just tried 1.22, the users with "User visibility: Private" can't be highlighted when rendering. It is an old behavior from " Link mentioned user in markdown only if they are visible to viewer #21554 " (since 1.18). So this behavior is not a regression.

Do you have more clues about what's broken?

Update: outdated, I think I know the problem now.

Image

@wxiaoguang commented on GitHub (Feb 11, 2025): ~~I just tried 1.22, the users with "User visibility: Private" can't be highlighted when rendering. It is an old behavior from " Link mentioned user in markdown only if they are visible to viewer #21554 " (since 1.18). So this behavior is not a regression.~~ ~~Do you have more clues about what's broken?~~ Update: outdated, I think I know the problem now. <details> ![Image](https://github.com/user-attachments/assets/0bb63b8c-3652-4059-9efd-93cc61014434) </details>
Author
Owner

@wxiaoguang commented on GitHub (Feb 11, 2025):

I think I can understand the problem now.

#21554 uses ctx.(*gitea_context.Context) to try to get the web context, it's not right in many cases.

-> Fix context usage #33554

@wxiaoguang commented on GitHub (Feb 11, 2025): I think I can understand the problem now. #21554 uses `ctx.(*gitea_context.Context)` to try to get the web context, it's not right in many cases. -> Fix context usage #33554
Author
Owner

@aceArt-GmbH commented on GitHub (Feb 11, 2025):

@wxiaoguang thanks for taking a look and fixing 💟
I think this does only affect highlighting and not mentions, but a backport would still be awesome.

Not leaking hidden users is fine, but at least the users that are shown in the autocomplete popup should also be linked (as their presents is already leaked) 😉

@aceArt-GmbH commented on GitHub (Feb 11, 2025): @wxiaoguang thanks for taking a look and fixing 💟 I think this does only affect highlighting and not mentions, but a backport would still be awesome. Not leaking hidden users is fine, but at least the users that are shown in the autocomplete popup should also be linked (as their presents is already leaked) 😉
Author
Owner

@wxiaoguang commented on GitHub (Feb 11, 2025):

Yes, it will be backported to 1.23 (I have marked #33554 as "backport/1.23")

Actually it is a regression in 1.23, the full story is like this:

  • #21554 uses direct type-casting (ctx.(*gitea_context.Context)) to get the web context.
  • at that time, it worked, because the ctx was the web context.
  • in 1.23, we refactored the markup rendering system (fixed a lot of legacy problems), and started using a general ctx (not a direct web context anymore)
  • then, the general ctx can't be read by ctx.(*gitea_context.Context) anymore, then #21554 's logic breaks
  • even there are tests, it's unable to catch such an edge case.

It tells us that we need to follow framework's design to write code (again) 😆

@wxiaoguang commented on GitHub (Feb 11, 2025): Yes, it will be backported to 1.23 (I have marked #33554 as "backport/1.23") Actually it is a regression in 1.23, the full story is like this: * `#21554` uses direct type-casting (`ctx.(*gitea_context.Context)`) to get the web context. * at that time, it worked, because the ctx was the web context. * in 1.23, we refactored the markup rendering system (fixed a lot of legacy problems), and started using a general ctx (not a direct web context anymore) * then, the general ctx can't be read by `ctx.(*gitea_context.Context)` anymore, then `#21554` 's logic breaks * even there are tests, it's unable to catch such an edge case. It tells us that we need to follow framework's design to write code (again) 😆
Author
Owner

@wxiaoguang commented on GitHub (Feb 11, 2025):

The backport (Fix context usage (#33554) (#33557)) for 1.23 is ready in 1.23 nightly

@wxiaoguang commented on GitHub (Feb 11, 2025): The backport (Fix context usage (#33554) (#33557)) for 1.23 is ready in 1.23 nightly * https://dl.gitea.com/gitea/1.23-nightly/ * https://hub.docker.com/r/gitea/gitea/tags?name=1.23-nightly
Author
Owner

@aceArt-GmbH commented on GitHub (Feb 11, 2025):

Works. thanks 💓

@aceArt-GmbH commented on GitHub (Feb 11, 2025): > * https://hub.docker.com/r/gitea/gitea/tags?name=1.23-nightly Works. thanks 💓
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14104