-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add more Links to Comments #25049
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
base: main
Are you sure you want to change the base?
Add more Links to Comments #25049
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1554,6 +1554,21 @@ func ViewIssue(ctx *context.Context) { | |
if comment.MilestoneID > 0 && comment.Milestone == nil { | ||
comment.Milestone = ghostMilestone | ||
} | ||
|
||
if comment.Milestone != nil && comment.Milestone.ID != -1 { | ||
err = comment.Milestone.LoadRepo(ctx) | ||
if err != nil { | ||
ctx.ServerError("LoadMilestoneRepo", err) | ||
return | ||
} | ||
} | ||
if comment.OldMilestone != nil && comment.OldMilestone.ID != -1 { | ||
err = comment.OldMilestone.LoadRepo(ctx) | ||
if err != nil { | ||
ctx.ServerError("LoadMilestoneRepo", err) | ||
return | ||
} | ||
} | ||
Comment on lines
+1558
to
+1571
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend two separate methods |
||
} else if comment.Type == issues_model.CommentTypeProject { | ||
|
||
if err = comment.LoadProject(); err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,7 +195,15 @@ | |
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}} | ||
<span class="text grey muted-links"> | ||
{{template "shared/user/authorlink" .Poster}} | ||
{{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.locale.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}} | ||
{{if gt .OldMilestoneID 0}} | ||
{{if gt .MilestoneID 0}} | ||
{{$.locale.Tr "repo.issues.change_milestone_at" (printf `<a href="%s">%s</a>` .OldMilestone.Link (.OldMilestone.Name|Escape)) (printf `<a href="%s">%s</a>` .Milestone.Link (.Milestone.Name|Escape)) $createdStr | Safe}} | ||
{{else}} | ||
{{$.locale.Tr "repo.issues.remove_milestone_at" (printf `<a href="%s">%s</a>` .OldMilestone.Link (.OldMilestone.Name|Escape)) $createdStr | Safe}} | ||
{{end}} | ||
{{else if gt .MilestoneID 0}} | ||
{{$.locale.Tr "repo.issues.add_milestone_at" (printf `<a href="%s">%s</a>` .Milestone.Link (.Milestone.Name|Escape)) $createdStr | Safe}} | ||
{{end}} | ||
</span> | ||
</div> | ||
{{else if eq .Type 9}} | ||
|
@@ -209,7 +217,7 @@ | |
{{if eq .Poster.ID .Assignee.ID}} | ||
{{$.locale.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}} | ||
{{else}} | ||
{{$.locale.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}} | ||
{{$.locale.Tr "repo.issues.remove_assignee_at" (printf `<a href="%s">%s</a>` .Poster.HomeLink (.Poster.GetDisplayName|Escape)) $createdStr | Safe}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are adding the same exact call that many times that we should perhaps extract it into a separate function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only used in this template. Do we really need a own function for for every object something that is used in a single template a few times? |
||
{{end}} | ||
</span> | ||
{{else}} | ||
|
@@ -219,7 +227,7 @@ | |
{{if eq .Poster.ID .AssigneeID}} | ||
{{$.locale.Tr "repo.issues.self_assign_at" $createdStr | Safe}} | ||
{{else}} | ||
{{$.locale.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}} | ||
{{$.locale.Tr "repo.issues.add_assignee_at" (printf `<a href="%s">%s</a>` .Poster.HomeLink (.Poster.GetDisplayName|Escape)) $createdStr | Safe}} | ||
{{end}} | ||
</span> | ||
{{end}} | ||
|
@@ -743,12 +751,12 @@ | |
{{$oldProjectDisplayHtml := "Unknown Project"}} | ||
{{if .OldProject}} | ||
{{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}} | ||
{{$oldProjectDisplayHtml = printf `<span data-tooltip-content="%s">%s</span>` ($.locale.Tr $trKey | Escape) (.OldProject.Title | Escape)}} | ||
{{$oldProjectDisplayHtml = printf `<a href="%s" data-tooltip-content="%s">%s</a>` .OldProject.Link ($.locale.Tr $trKey | Escape) (.OldProject.Title | Escape)}} | ||
{{end}} | ||
{{$newProjectDisplayHtml := "Unknown Project"}} | ||
{{if .Project}} | ||
{{$trKey := printf "projects.type-%d.display_name" .Project.Type}} | ||
{{$newProjectDisplayHtml = printf `<span data-tooltip-content="%s">%s</span>` ($.locale.Tr $trKey | Escape) (.Project.Title | Escape)}} | ||
{{$newProjectDisplayHtml = printf `<a href="%s" data-tooltip-content="%s">%s</a>` .Project.Link ($.locale.Tr $trKey | Escape) (.Project.Title | Escape)}} | ||
{{end}} | ||
{{if and (gt .OldProjectID 0) (gt .ProjectID 0)}} | ||
{{$.locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr | Safe}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want
m.Repo.Link
here.HTMLURL
is absolute whileLink
should be relative.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.