From 7cb7309097245d4c038c449c695a770ca5cd3bd1 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Fri, 1 Apr 2022 14:17:59 +0100 Subject: [PATCH] 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. --- submit.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/submit.go b/submit.go index 7ebda8c..df6d84e 100644 --- a/submit.go +++ b/submit.go @@ -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)