mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
2978 files. The fork is 2026-07-15 (rebrand: gitea.dev -> github.com/hanzoai/git), so 2026 is the year, and "Copyright 2026 Hanzo AI, Inc." was already the form used by the handful of files that had ours. Shape is now: // Copyright 2026 Hanzo AI, Inc. All rights reserved. // Copyright 2015 The Gogs Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT Ours on top, theirs retained verbatim. Retained because MIT requires it, and separately because they are true — those authors did write that code. Not renamed to "The Git Authors": Git is a different project under a different license, and putting its name here would attribute this code to people who have nothing to do with it. Adding our line is the fix; overwriting theirs would have been both a licence violation and a false statement. gofmt still reports import-order drift in some of these files. It predates this change (verified against a stash) and is left alone rather than burying a one-line-per-file legal change under 3000 files of unrelated reordering. Build clean. Co-authored-by: Hanzo Dev <[email protected]>
50 lines
2.0 KiB
Go
50 lines
2.0 KiB
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package templates
|
|
|
|
import (
|
|
"html/template"
|
|
"strings"
|
|
|
|
issues_model "github.com/hanzoai/git/models/issues"
|
|
"github.com/hanzoai/git/modules/htmlutil"
|
|
"github.com/hanzoai/git/modules/setting"
|
|
"github.com/hanzoai/git/modules/svg"
|
|
"github.com/hanzoai/git/modules/translation"
|
|
"github.com/hanzoai/git/modules/util"
|
|
)
|
|
|
|
func commentTimelineEventIsWipToggle(c *issues_model.Comment) (isToggle, isWip bool) {
|
|
title1, ok1 := issues_model.CutWorkInProgressPrefix(c.OldTitle)
|
|
title2, ok2 := issues_model.CutWorkInProgressPrefix(c.NewTitle)
|
|
return ok1 != ok2 && strings.TrimSpace(title1) == strings.TrimSpace(title2), ok2
|
|
}
|
|
|
|
func (ut *RenderUtils) RenderTimelineEventBadge(c *issues_model.Comment) template.HTML {
|
|
if c.Type == issues_model.CommentTypeChangeTitle {
|
|
isToggle, isWip := commentTimelineEventIsWipToggle(c)
|
|
if !isToggle {
|
|
return svg.RenderHTML("octicon-pencil")
|
|
}
|
|
return util.Iif(isWip, svg.RenderHTML("octicon-git-pull-request-draft"), svg.RenderHTML("octicon-eye"))
|
|
}
|
|
setting.PanicInDevOrTesting("unimplemented comment type %v: %v", c.Type, c)
|
|
return htmlutil.HTMLFormat("(CommentType:%v)", c.Type)
|
|
}
|
|
|
|
func (ut *RenderUtils) RenderTimelineEventComment(c *issues_model.Comment, createdStr template.HTML) template.HTML {
|
|
if c.Type == issues_model.CommentTypeChangeTitle {
|
|
locale := ut.ctx.Value(translation.ContextKey).(translation.Locale)
|
|
isToggle, isWip := commentTimelineEventIsWipToggle(c)
|
|
if !isToggle {
|
|
return locale.Tr("repo.issues.change_title_at", ut.RenderEmoji(c.OldTitle), ut.RenderEmoji(c.NewTitle), createdStr)
|
|
}
|
|
trKey := util.Iif(isWip, "repo.pulls.marked_as_work_in_progress_at", "repo.pulls.marked_as_ready_for_review_at")
|
|
return locale.Tr(trKey, createdStr)
|
|
}
|
|
setting.PanicInDevOrTesting("unimplemented comment type %v: %v", c.Type, c)
|
|
return htmlutil.HTMLFormat("(Comment:%v,%v)", c.Type, c.Content)
|
|
}
|