Add ID field containing the prefix used to create the listing.

This listing needs to be unique for the rageshake to be stored to disk,
so can be relied upon in future to be unique(enough) for other services
working with the rageshake.
This commit is contained in:
Michael Kaye 2022-04-01 14:17:59 +01:00
parent 1d008a0aad
commit 7cb7309097

View file

@ -85,6 +85,7 @@ type genericWebhookPayload struct {
// the payload after parsing
type parsedPayload struct {
ID string `json:"id"`
UserText string `json:"user_text"`
AppName string `json:"app"`
Data map[string]string `json:"data"`
@ -178,6 +179,11 @@ func (s *submitServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
// We use this prefix (eg, 2022-05-01/125223-abcde) as a unique identifier for this rageshake.
// This is going to be used to uniquely identify rageshakes, even if they are not submitted to
// an issue tracker for instance with automatic rageshakes that can be plentiful
p.ID = prefix
resp, err := s.saveReport(req.Context(), *p, reportDir, listingURL)
if err != nil {
log.Println("Error handling report submission:", err)