Fix compose page when replying to messages

face-detect
Noah Petherbridge 2023-09-25 18:13:13 -07:00
parent 8456c5d0f5
commit e5b5b9435b
1 changed files with 6 additions and 6 deletions

View File

@ -41,12 +41,6 @@ func Compose() http.HandlerFunc {
return
}
// If we already have a thread open with them, go to that instead of the stand-alone compose page.
if msgID, ok := models.HasMessageThread(currentUser, user); ok {
templates.Redirect(w, fmt.Sprintf("/messages/read/%d", msgID))
return
}
// POSTing?
if r.Method == http.MethodPost {
var (
@ -75,6 +69,12 @@ func Compose() http.HandlerFunc {
return
}
// If we already have a thread open with them, go to that instead of the stand-alone compose page.
if msgID, ok := models.HasMessageThread(currentUser, user); ok {
templates.Redirect(w, fmt.Sprintf("/messages/read/%d", msgID))
return
}
// On GET request (come from a user profile page):
// Do not allow a shy user to initiate DMs with a non-shy one.
var (