Skip to content

Commit

Permalink
remove unused formatting function and resolve some formatting weirdness
Browse files Browse the repository at this point in the history
  • Loading branch information
Balk-Z committed Dec 6, 2024
1 parent f383f77 commit 8c8fea6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
6 changes: 1 addition & 5 deletions handlers/templates/pages/file-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ <h1 class="title">Files</h1>
</td>
<td class="is-vcentered">{{ formatFileSize .Size }}</td>
<td class="is-vcentered">{{ formatDate .Uploaded }}</td>
<td class="is-vcentered">
<a href="/files/{{ .ID }}/downloads" aria-label="Download count"
>{{ .DownloadCount }}</a
>
</td>
<td class="is-vcentered">{{ .DownloadCount }}</td>
<td class="is-vcentered">
{{- formatExpiration .Expires -}}
</td>
Expand Down
12 changes: 0 additions & 12 deletions handlers/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,6 @@ func (s Server) guestLinkIndexGet() http.HandlerFunc {
}
return fmt.Sprintf("%s (%.0f days%s)", t.Format(time.DateOnly), math.Abs(delta.Hours())/24, suffix)
},
"formatFileExpiration": func(et picoshare.ExpirationTime) string {
if et == picoshare.NeverExpire {
return "Never"
}
t := time.Time(et)
letterS := "s"
delta := time.Until(t)
if delta.Hours() < 25 {
letterS = ""
}
return fmt.Sprintf("After %.0f day%s", math.Abs(delta.Hours())/24, letterS)
},
"isActive": func(gl picoshare.GuestLink) bool {
return gl.IsActive()
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ALTER TABLE guest_links
RENAME COLUMN expiration_time to url_expiration_time;
RENAME COLUMN expiration_time TO url_expiration_time;

ALTER TABLE guest_links
ADD file_expiration_time TEXT;

UPDATE guest_links
SET file_expiration_time = 'NEVER'
WHERE file_expiration_time IS NULL;
WHERE file_expiration_time IS NULL;

0 comments on commit 8c8fea6

Please sign in to comment.