Skip to content

Commit

Permalink
fix gpg expired bug when time is zero (#3584)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and lafriks committed Feb 26, 2018
1 parent 521945a commit 769ab1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions modules/util/time_stamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ func (ts TimeStamp) FormatLong() string {
func (ts TimeStamp) FormatShort() string {
return ts.Format("Jan 02, 2006")
}

// IsZero is zero time
func (ts TimeStamp) IsZero() bool {
return ts.AsTime().IsZero()
}
2 changes: 1 addition & 1 deletion templates/user/settings/keys_gpg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="activity meta">
<i>{{$.i18n.Tr "settings.add_on"}} <span>{{.AddedUnix.FormatShort}}</span></i>
-
<i>{{if .ExpiredUnix}}{{$.i18n.Tr "settings.valid_until"}} <span>{{.ExpiredUnix.FormatShort}}</span>{{else}}{{$.i18n.Tr "settings.valid_forever"}}{{end}}</i>
<i>{{if not .ExpiredUnix.IsZero}}{{$.i18n.Tr "settings.valid_until"}} <span>{{.ExpiredUnix.FormatShort}}</span>{{else}}{{$.i18n.Tr "settings.valid_forever"}}{{end}}</i>
</div>
</div>
</div>
Expand Down

0 comments on commit 769ab1e

Please sign in to comment.