mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 18:45:53 +00:00
Preserve webhook mentions in list API (#1118)
This commit is contained in:
@@ -249,6 +249,10 @@ func (h *NotificationHandlers) GetWebhooks(w http.ResponseWriter, r *http.Reques
|
||||
whMap["template"] = webhook.Template
|
||||
}
|
||||
|
||||
if webhook.Mention != "" {
|
||||
whMap["mention"] = webhook.Mention
|
||||
}
|
||||
|
||||
maskedWebhooks[i] = whMap
|
||||
}
|
||||
|
||||
|
||||
@@ -358,6 +358,7 @@ func TestNotificationHandlers(t *testing.T) {
|
||||
Name: "Test Webhook",
|
||||
URL: "https://example.com",
|
||||
Headers: map[string]string{"Authorization": "Bearer token"},
|
||||
Mention: "@everyone",
|
||||
},
|
||||
}
|
||||
mockManager.On("GetWebhooks").Return(webhooks).Once()
|
||||
@@ -371,6 +372,7 @@ func TestNotificationHandlers(t *testing.T) {
|
||||
json.Unmarshal(w.Body.Bytes(), &resp)
|
||||
assert.Equal(t, 1, len(resp))
|
||||
assert.Equal(t, "wh1", resp[0]["id"])
|
||||
assert.Equal(t, "@everyone", resp[0]["mention"])
|
||||
headers := resp[0]["headers"].(map[string]interface{})
|
||||
assert.Equal(t, "***REDACTED***", headers["Authorization"])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user