File tree 3 files changed +14
-8
lines changed
templates/repo/issue/view_content
3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ func NewFuncMap() template.FuncMap {
71
71
"CountFmt" : base .FormatNumberSI ,
72
72
"Sec2Time" : util .SecToTime ,
73
73
74
- "TimeEstimateString" : util . TimeEstimateString ,
74
+ "TimeEstimateString" : timeEstimateString ,
75
75
76
76
"LoadTimes" : func (startTime time.Time ) string {
77
77
return fmt .Sprint (time .Since (startTime ).Nanoseconds ()/ 1e6 ) + "ms"
@@ -285,6 +285,14 @@ func userThemeName(user *user_model.User) string {
285
285
return setting .UI .DefaultTheme
286
286
}
287
287
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
+
288
296
func panicIfDevOrTesting () {
289
297
if ! setting .IsProd || setting .IsInTesting {
290
298
panic ("legacy template functions are for backward compatibility only, do not use them in new code" )
Original file line number Diff line number Diff line change @@ -1681,7 +1681,7 @@ issues.time_estimate_placeholder = 1h 2m
1681
1681
issues.time_estimate_set = Set estimated time
1682
1682
issues.time_estimate_display = Estimate: %s
1683
1683
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
1685
1685
issues.time_estimate_invalid = Time estimate format is invalid
1686
1686
issues.start_tracking_history = started working %s
1687
1687
issues.tracker_auto_close = Timer will be stopped automatically when this issue gets closed
Original file line number Diff line number Diff line change 696
696
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
697
697
<span class="text grey muted-links">
698
698
{{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}}
703
702
{{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}}
706
704
{{end}}
707
705
</span>
708
706
</div>
You can’t perform that action at this time.
0 commit comments