Show 404 when remote user not found
This notifies the user that the remote user doesn't exist, instead of showing a blank page. Ref T627
This commit is contained in:
parent
81edb739dd
commit
867eb53b35
|
@ -862,9 +862,9 @@ func handleViewMention(app *App, w http.ResponseWriter, r *http.Request) error {
|
||||||
handle := vars["handle"]
|
handle := vars["handle"]
|
||||||
|
|
||||||
remoteUser, err := app.db.GetProfilePageFromHandle(app, handle)
|
remoteUser, err := app.db.GetProfilePageFromHandle(app, handle)
|
||||||
if err != nil {
|
if err != nil || remoteUser == "" {
|
||||||
log.Error("Couldn't find this user "+handle, err)
|
log.Error("Couldn't find user %s: %v", handle, err)
|
||||||
return nil
|
return ErrRemoteUserNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
return impart.HTTPError{Status: http.StatusFound, Message: remoteUser}
|
return impart.HTTPError{Status: http.StatusFound, Message: remoteUser}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2018 A Bunch Tell LLC.
|
* Copyright © 2018-2020 A Bunch Tell LLC.
|
||||||
*
|
*
|
||||||
* This file is part of WriteFreely.
|
* This file is part of WriteFreely.
|
||||||
*
|
*
|
||||||
|
@ -45,8 +45,9 @@ var (
|
||||||
ErrPostUnpublished = impart.HTTPError{Status: http.StatusGone, Message: "Post unpublished by author."}
|
ErrPostUnpublished = impart.HTTPError{Status: http.StatusGone, Message: "Post unpublished by author."}
|
||||||
ErrPostFetchError = impart.HTTPError{Status: http.StatusInternalServerError, Message: "We encountered an error getting the post. The humans have been alerted."}
|
ErrPostFetchError = impart.HTTPError{Status: http.StatusInternalServerError, Message: "We encountered an error getting the post. The humans have been alerted."}
|
||||||
|
|
||||||
ErrUserNotFound = impart.HTTPError{http.StatusNotFound, "User doesn't exist."}
|
ErrUserNotFound = impart.HTTPError{http.StatusNotFound, "User doesn't exist."}
|
||||||
ErrUserNotFoundEmail = impart.HTTPError{http.StatusNotFound, "Please enter your username instead of your email address."}
|
ErrRemoteUserNotFound = impart.HTTPError{http.StatusNotFound, "Remote user not found."}
|
||||||
|
ErrUserNotFoundEmail = impart.HTTPError{http.StatusNotFound, "Please enter your username instead of your email address."}
|
||||||
|
|
||||||
ErrUserSuspended = impart.HTTPError{http.StatusForbidden, "Account is silenced."}
|
ErrUserSuspended = impart.HTTPError{http.StatusForbidden, "Account is silenced."}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue