From 9b69de166fd539b66542518cda9dd170080c0ad6 Mon Sep 17 00:00:00 2001 From: Rob Loranger Date: Mon, 11 Nov 2019 14:25:34 -0800 Subject: [PATCH 1/8] add silenced warning on invites page --- invites.go | 10 +++++++++- templates/user/invite.tmpl | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/invites.go b/invites.go index 1dba7bd..63216fa 100644 --- a/invites.go +++ b/invites.go @@ -56,12 +56,20 @@ func handleViewUserInvites(app *App, u *User, w http.ResponseWriter, r *http.Req p := struct { *UserPage - Invites *[]Invite + Invites *[]Invite + Suspended bool }{ UserPage: NewUserPage(app, r, u, "Invite People", f), } var err error + + p.Suspended, err = app.db.IsUserSuspended(u.ID) + if err != nil { + log.Error("view invites: %v", err) + return ErrInternalGeneral + } + p.Invites, err = app.db.GetUserInvites(u.ID) if err != nil { return err diff --git a/templates/user/invite.tmpl b/templates/user/invite.tmpl index 1985bd5..edf7061 100644 --- a/templates/user/invite.tmpl +++ b/templates/user/invite.tmpl @@ -31,6 +31,9 @@ table td {
+ {{if .Suspended}} + {{template "user-suspended"}} + {{end}}

Invite people

Invite others to join {{.SiteName}} by generating and sharing invite links below.

From 0766e6cb366a464327c8e20f2da987e71d5bcebc Mon Sep 17 00:00:00 2001 From: Rob Loranger Date: Tue, 14 Jan 2020 10:44:56 -0800 Subject: [PATCH 2/8] fixes imported post times changes the client side to round the unix time to avoid floats alters the time to match the client time zone on the server side --- account_import.go | 8 ++++++++ templates/user/import.tmpl | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/account_import.go b/account_import.go index b34f3a7..1098798 100644 --- a/account_import.go +++ b/account_import.go @@ -9,6 +9,7 @@ import ( "net/http" "os" "path/filepath" + "strconv" "strings" "time" @@ -85,6 +86,7 @@ func handleImport(app *App, u *User, w http.ResponseWriter, r *http.Request) err log.Error("invalid form data for file dates: %v", err) return impart.HTTPError{http.StatusBadRequest, "form data for file dates was invalid"} } + fileTZ := r.FormValue("tz") files := r.MultipartForm.File["files"] var fileErrs []error filesSubmitted := len(files) @@ -147,6 +149,12 @@ func handleImport(app *App, u *User, w http.ResponseWriter, r *http.Request) err post.Collection = collAlias } dateTime := time.Unix(fileDates[formFile.Filename], 0) + offset, err := strconv.Atoi(fileTZ) + if err != nil { + log.Error("form time zone offset not a valid integer: %v", err) + continue + } + dateTime = dateTime.Add(time.Minute * time.Duration(offset)) post.Created = &dateTime created := post.Created.Format("2006-01-02T15:04:05Z") submittedPost := SubmittedPost{ diff --git a/templates/user/import.tmpl b/templates/user/import.tmpl index 3400e2f..06ff8b7 100644 --- a/templates/user/import.tmpl +++ b/templates/user/import.tmpl @@ -32,6 +32,7 @@ +