Skip to main content

internal/api/feedback.go

internal/api · 106 lines · 5 declarations · source

Declarations

type feedbackListRequest

type feedbackListRequest struct {
RecordID string `json:"record_id,omitempty"`
OpenOnly bool `json:"open_only,omitempty"`
After *pg.FeedbackCursor `json:"after,omitempty"`
Limit *int `json:"limit,omitempty"`
}

feedbackListRequest narrows the queue. Both filters are optional and both are server-side: a client that could only filter after receiving the page would be reading every open report on the project to find the one about its record.

source

method Server.recordFeedback

func (s *Server) recordFeedback(w http.ResponseWriter, r *http.Request, grant credential.Grant)

Attribution comes from the credential, never from the body — the same rule a correction follows, for the same reason: a report whose author is a claim is not evidence of anything.

source

method Server.listFeedback

func (s *Server) listFeedback(w http.ResponseWriter, r *http.Request, grant credential.Grant)

source

method Server.promoteFeedback

func (s *Server) promoteFeedback(w http.ResponseWriter, r *http.Request, grant credential.Grant)

source

method Server.feedbackError

func (s *Server) feedbackError(w http.ResponseWriter, r *http.Request, grant credential.Grant, operation string, err error, message string)

feedbackError keeps client-supplied identifiers, note text and database error text out of both the ledger and the log. A refused operation is recorded as refused and nothing about its content is.

source