Don't show questions for preview surveys
This commit is contained in:
parent
0a79763f69
commit
80776bb7a1
4 changed files with 16 additions and 2 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
@ -19,6 +20,9 @@ func init() {
|
|||
if !s.Shown && !u.IsAdmin {
|
||||
return APIErrorResponse{err:errors.New("Not accessible")}
|
||||
}
|
||||
if s.StartAvailability.After(time.Now()) && !u.IsAdmin {
|
||||
return APIErrorResponse{status: http.StatusPaymentRequired, err:errors.New("Not available yet")}
|
||||
}
|
||||
return formatApiResponse(s.GetQuestions())
|
||||
}), loggedUser))
|
||||
router.POST("/api/surveys/:sid/questions", apiAuthHandler(surveyAuthHandler(func(s Survey, u *User, body []byte) HTTPResponse {
|
||||
|
|
Reference in a new issue