diff --git a/pkg/controller/forum/new_post.go b/pkg/controller/forum/new_post.go index bc23c33..1e95046 100644 --- a/pkg/controller/forum/new_post.go +++ b/pkg/controller/forum/new_post.go @@ -233,11 +233,23 @@ func NewPost() http.HandlerFunc { // A message OR a photo is required. if forum.PermitPhotos && message == "" && commentPhoto == nil { session.FlashError(w, r, "A message OR photo is required for this post.") - templates.Redirect(w, fmt.Sprintf("/forum/thread/%d", thread.ID)) + if thread != nil { + templates.Redirect(w, fmt.Sprintf("/forum/thread/%d", thread.ID)) + } else if forum != nil { + templates.Redirect(w, fmt.Sprintf("/f/%s", forum.Fragment)) + } else { + templates.Redirect(w, "/forum") + } return } else if !forum.PermitPhotos && message == "" { session.FlashError(w, r, "A message is required for this post.") - templates.Redirect(w, fmt.Sprintf("/forum/thread/%d", thread.ID)) + if thread != nil { + templates.Redirect(w, fmt.Sprintf("/forum/thread/%d", thread.ID)) + } else if forum != nil { + templates.Redirect(w, fmt.Sprintf("/f/%s", forum.Fragment)) + } else { + templates.Redirect(w, "/forum") + } return }