this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

automod: small fixes (#469)

didn't want to clutter other PRs with these

authored by

bnewbold and committed by
GitHub
4bfee6d5 b805deef

+5 -3
+4 -2
automod/slack.go
··· 18 18 func (e *Engine) SendSlackMsg(ctx context.Context, msg string) error { 19 19 // loosely based on: https://golangcode.com/send-slack-messages-without-a-library/ 20 20 21 - body, _ := json.Marshal(SlackWebhookBody{Text: msg}) 21 + body, err := json.Marshal(SlackWebhookBody{Text: msg}) 22 + if err != nil { 23 + return err 24 + } 22 25 req, err := http.NewRequestWithContext(ctx, http.MethodPost, e.SlackWebhookURL, bytes.NewBuffer(body)) 23 26 if err != nil { 24 27 return err ··· 35 38 buf := new(bytes.Buffer) 36 39 buf.ReadFrom(resp.Body) 37 40 if resp.StatusCode != 200 || buf.String() != "ok" { 38 - // TODO: in some cases print body? eg, if short and text 39 41 return fmt.Errorf("failed slack webhook POST request. status=%d", resp.StatusCode) 40 42 } 41 43 return nil
+1 -1
cmd/hepa/server.go
··· 55 55 return nil, fmt.Errorf("specified bgs host must include 'ws://' or 'wss://'") 56 56 } 57 57 58 - // TODO: this isn't a very robust way to handle a peristent client 58 + // TODO: this isn't a very robust way to handle a persistent client 59 59 var xrpcc *xrpc.Client 60 60 if config.ModAdminToken != "" { 61 61 xrpcc = &xrpc.Client{