Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to user profile in markdown mention only if user exists #21533

Merged
merged 19 commits into from
Oct 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Drop db dependency
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
  • Loading branch information
yardenshoham committed Oct 22, 2022
commit d2b211ee553149c648d74e090a18af18d36e9afb
3 changes: 1 addition & 2 deletions modules/markup/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"strings"
"sync"

"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/emoji"
Expand Down Expand Up @@ -608,7 +607,7 @@ func mentionProcessor(ctx *RenderContext, node *html.Node) {
mentionedUsername := mention[1:]

// Only link if the user actually exists
userExists, err := user.IsUserExist(db.DefaultContext, 0, mentionedUsername)
userExists, err := user.IsUserExist(ctx.Ctx, 0, mentionedUsername)
if err != nil {
log.Error("Failed to validate user in mention %v exists, assuming it does", mention)
userExists = true
Expand Down