Selaa lähdekoodia

Merge pull request #138 from writeas/fix-unpublished-state

Don't consider post unpublished when title exists
pull/147/head
Matt Baer 4 vuotta sitten
committed by GitHub
vanhempi
commit
ba3cb4b4ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. +3
    -3
      database.go
  2. +1
    -1
      posts.go

+ 3
- 3
database.go Näytä tiedosto

@@ -926,7 +926,7 @@ func (db *datastore) GetEditablePost(id, editToken string) (*PublicPost, error)
return nil, err
}

if p.Content == "" {
if p.Content == "" && p.Title.String == "" {
return nil, ErrPostUnpublished
}

@@ -976,7 +976,7 @@ func (db *datastore) GetPost(id string, collectionID int64) (*PublicPost, error)
return nil, err
}

if p.Content == "" {
if p.Content == "" && p.Title.String == "" {
return nil, ErrPostUnpublished
}

@@ -1005,7 +1005,7 @@ func (db *datastore) GetOwnedPost(id string, ownerID int64) (*PublicPost, error)
return nil, err
}

if p.Content == "" {
if p.Content == "" && p.Title.String == "" {
return nil, ErrPostUnpublished
}



+ 1
- 1
posts.go Näytä tiedosto

@@ -1309,7 +1309,7 @@ func viewCollectionPost(app *App, w http.ResponseWriter, r *http.Request) error
p.IsTopLevel = app.cfg.App.SingleUser

// Check if post has been unpublished
if p.Content == "" {
if p.Content == "" && p.Title.String == "" {
return impart.HTTPError{http.StatusGone, "Post was unpublished."}
}



Ladataan…
Peruuta
Tallenna