diff --git a/backend/app/rest/api/rest_test.go b/backend/app/rest/api/rest_test.go index 73c6c0fd..e10cb527 100644 --- a/backend/app/rest/api/rest_test.go +++ b/backend/app/rest/api/rest_test.go @@ -98,7 +98,7 @@ func prep(t *testing.T) (srv *Rest, ts *httptest.Server) { EditDuration: 5 * time.Minute, MaxCommentSize: 4000, AdminStore: adminStore, - MaxVotes: -1, + MaxVotes: service.UnlimitedVotes, } srv = &Rest{ DataService: dataStore, diff --git a/backend/app/store/service/service.go b/backend/app/store/service/service.go index 0ceac45a..1517acca 100644 --- a/backend/app/store/service/service.go +++ b/backend/app/store/service/service.go @@ -29,7 +29,9 @@ type DataStore struct { } const defaultCommentMaxSize = 2000 -const defaultVotesLimit = -1 // unlimited + +// UnlimitedVotes doesn't restrict MaxVotes +const UnlimitedVotes = -1 // Create prepares comment and forward to Interface.Create func (s *DataStore) Create(comment store.Comment) (commentID string, err error) { @@ -100,8 +102,8 @@ func (s *DataStore) Vote(locator store.Locator, commentID string, userID string, } maxVotes := s.MaxVotes - if s.MaxVotes < 0 { - maxVotes = defaultVotesLimit + if s.MaxVotes <= 0 { + maxVotes = UnlimitedVotes } if maxVotes >= 0 && len(comment.Votes) >= maxVotes {