mirror of
https://github.com/go-gitea/gitea
synced 2024-11-11 04:21:21 +01:00
Backport #31732 by @yp05327 Fix: #31727 After: ![image](https://github.com/user-attachments/assets/1dfb4b31-3bd6-47f7-b126-650f33f453e2) Co-authored-by: yp05327 <576951401@qq.com>
This commit is contained in:
parent
ec467c344f
commit
8591c918f6
4 changed files with 19 additions and 5 deletions
|
@ -109,6 +109,13 @@ type Project struct {
|
||||||
ClosedDateUnix timeutil.TimeStamp
|
ClosedDateUnix timeutil.TimeStamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ghost Project is a project which has been deleted
|
||||||
|
const GhostProjectID = -1
|
||||||
|
|
||||||
|
func (p *Project) IsGhost() bool {
|
||||||
|
return p.ID == GhostProjectID
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Project) LoadOwner(ctx context.Context) (err error) {
|
func (p *Project) LoadOwner(ctx context.Context) (err error) {
|
||||||
if p.Owner != nil {
|
if p.Owner != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -3675,6 +3675,7 @@ variables.update.failed = Failed to edit variable.
|
||||||
variables.update.success = The variable has been edited.
|
variables.update.success = The variable has been edited.
|
||||||
|
|
||||||
[projects]
|
[projects]
|
||||||
|
deleted.display_name = Deleted Project
|
||||||
type-1.display_name = Individual Project
|
type-1.display_name = Individual Project
|
||||||
type-2.display_name = Repository Project
|
type-2.display_name = Repository Project
|
||||||
type-3.display_name = Organization Project
|
type-3.display_name = Organization Project
|
||||||
|
|
|
@ -1669,7 +1669,7 @@ func ViewIssue(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ghostProject := &project_model.Project{
|
ghostProject := &project_model.Project{
|
||||||
ID: -1,
|
ID: project_model.GhostProjectID,
|
||||||
Title: ctx.Locale.TrString("repo.issues.deleted_project"),
|
Title: ctx.Locale.TrString("repo.issues.deleted_project"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -582,13 +582,19 @@
|
||||||
{{template "shared/user/authorlink" .Poster}}
|
{{template "shared/user/authorlink" .Poster}}
|
||||||
{{$oldProjectDisplayHtml := "Unknown Project"}}
|
{{$oldProjectDisplayHtml := "Unknown Project"}}
|
||||||
{{if .OldProject}}
|
{{if .OldProject}}
|
||||||
{{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}}
|
{{$tooltip := ctx.Locale.Tr "projects.deleted.display_name"}}
|
||||||
{{$oldProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr $trKey) .OldProject.Title}}
|
{{if not .OldProject.IsGhost}}
|
||||||
|
{{$tooltip = ctx.Locale.Tr (printf "projects.type-%d.display_name" .OldProject.Type)}}
|
||||||
|
{{end}}
|
||||||
|
{{$oldProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` $tooltip .OldProject.Title}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{$newProjectDisplayHtml := "Unknown Project"}}
|
{{$newProjectDisplayHtml := "Unknown Project"}}
|
||||||
{{if .Project}}
|
{{if .Project}}
|
||||||
{{$trKey := printf "projects.type-%d.display_name" .Project.Type}}
|
{{$tooltip := ctx.Locale.Tr "projects.deleted.display_name"}}
|
||||||
{{$newProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr $trKey) .Project.Title}}
|
{{if not .Project.IsGhost}}
|
||||||
|
{{$tooltip = ctx.Locale.Tr (printf "projects.type-%d.display_name" .Project.Type)}}
|
||||||
|
{{end}}
|
||||||
|
{{$newProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` $tooltip .Project.Title}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if and (gt .OldProjectID 0) (gt .ProjectID 0)}}
|
{{if and (gt .OldProjectID 0) (gt .ProjectID 0)}}
|
||||||
{{ctx.Locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr}}
|
{{ctx.Locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr}}
|
||||||
|
|
Loading…
Reference in a new issue