Support updating collection only with monetization_pointer

pull/464/head
Matt Baer 4 years ago
parent b010484493
commit 2938bba15a
  1. 12
      database.go

@ -875,7 +875,7 @@ func (db *datastore) UpdateCollection(c *SubmittedCollection, alias string) erro
// WHERE values
q.Where("alias = ? AND owner_id = ?", alias, c.OwnerID)
if q.Updates == "" {
if q.Updates == "" && c.Monetization == nil {
return ErrPostNoUpdatableVals
}
@ -932,10 +932,12 @@ func (db *datastore) UpdateCollection(c *SubmittedCollection, alias string) erro
}
// Update rest of the collection data
res, err = db.Exec("UPDATE collections SET "+q.Updates+" WHERE "+q.Conditions, q.Params...)
if err != nil {
log.Error("Unable to update collection: %v", err)
return err
if q.Updates != "" {
res, err = db.Exec("UPDATE collections SET "+q.Updates+" WHERE "+q.Conditions, q.Params...)
if err != nil {
log.Error("Unable to update collection: %v", err)
return err
}
}
rowsAffected, _ = res.RowsAffected()

Loading…
Cancel
Save