|
|
@ -17,6 +17,7 @@ import ( |
|
|
|
"github.com/go-sql-driver/mysql" |
|
|
|
"github.com/go-sql-driver/mysql" |
|
|
|
"github.com/writeas/web-core/silobridge" |
|
|
|
"github.com/writeas/web-core/silobridge" |
|
|
|
wf_db "github.com/writefreely/writefreely/db" |
|
|
|
wf_db "github.com/writefreely/writefreely/db" |
|
|
|
|
|
|
|
"github.com/writefreely/writefreely/parse" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
"net/url" |
|
|
|
"net/url" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
@ -862,6 +863,14 @@ func (db *datastore) GetCollectionFromDomain(host string) (*Collection, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (db *datastore) UpdateCollection(app *App, c *SubmittedCollection, alias string) error { |
|
|
|
func (db *datastore) UpdateCollection(app *App, c *SubmittedCollection, alias string) error { |
|
|
|
|
|
|
|
// Truncate fields correctly, so we don't get "Data too long for column" errors in MySQL (writefreely#600)
|
|
|
|
|
|
|
|
if c.Title != nil { |
|
|
|
|
|
|
|
*c.Title = parse.Truncate(*c.Title, collMaxLengthTitle) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if c.Description != nil { |
|
|
|
|
|
|
|
*c.Description = parse.Truncate(*c.Description, collMaxLengthDescription) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
q := query.NewUpdate(). |
|
|
|
q := query.NewUpdate(). |
|
|
|
SetStringPtr(c.Title, "title"). |
|
|
|
SetStringPtr(c.Title, "title"). |
|
|
|
SetStringPtr(c.Description, "description"). |
|
|
|
SetStringPtr(c.Description, "description"). |
|
|
|