Skip to content

Commit 2e8ec9d

Browse files
committed
fix action message
1 parent ea47f02 commit 2e8ec9d

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

modules/templates/helper.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func NewFuncMap() template.FuncMap {
7171
"CountFmt": base.FormatNumberSI,
7272
"Sec2Time": util.SecToTime,
7373

74-
"TimeEstimateString": util.TimeEstimateString,
74+
"TimeEstimateString": timeEstimateString,
7575

7676
"LoadTimes": func(startTime time.Time) string {
7777
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
@@ -285,6 +285,14 @@ func userThemeName(user *user_model.User) string {
285285
return setting.UI.DefaultTheme
286286
}
287287

288+
func timeEstimateString(timeSec any) string {
289+
v, _ := util.ToInt64(timeSec)
290+
if v == 0 {
291+
return ""
292+
}
293+
return util.TimeEstimateString(v)
294+
}
295+
288296
func panicIfDevOrTesting() {
289297
if !setting.IsProd || setting.IsInTesting {
290298
panic("legacy template functions are for backward compatibility only, do not use them in new code")

options/locale/locale_en-US.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ issues.time_estimate_placeholder = 1h 2m
16811681
issues.time_estimate_set = Set estimated time
16821682
issues.time_estimate_display = Estimate: %s
16831683
issues.change_time_estimate_at = changed time estimate to <b>%s</b> %s
1684-
issues.remove_time_estimate = removed time estimate %s
1684+
issues.remove_time_estimate_at = removed time estimate %s
16851685
issues.time_estimate_invalid = Time estimate format is invalid
16861686
issues.start_tracking_history = started working %s
16871687
issues.tracker_auto_close = Timer will be stopped automatically when this issue gets closed

templates/repo/issue/view_content/comments.tmpl

+4-6
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,11 @@
696696
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
697697
<span class="text grey muted-links">
698698
{{template "shared/user/authorlink" .Poster}}
699-
700-
{{if .RenderedContent}}
701-
{{/* compatibility with time comments made before v1.21 */}}
702-
{{ctx.Locale.Tr "repo.issues.change_time_estimate_at" .RenderedContent $createdStr | SafeHTML}}
699+
{{$timeStr := .Content|TimeEstimateString}}
700+
{{if $timeStr}}
701+
{{ctx.Locale.Tr "repo.issues.change_time_estimate_at" $timeStr $createdStr}}
703702
{{else}}
704-
{{$timeStr := .Content|Sec2Time}}
705-
{{ctx.Locale.Tr "repo.issues.change_time_estimate_at" $timeStr $createdStr | SafeHTML}}
703+
{{ctx.Locale.Tr "repo.issues.remove_time_estimate_at" $createdStr}}
706704
{{end}}
707705
</span>
708706
</div>

0 commit comments

Comments
 (0)