Format actions PR, changelog

This commit is contained in:
Philipp Heckel 2022-06-22 20:23:15 -04:00
parent e8569c6008
commit b4a824aa38
3 changed files with 10 additions and 9 deletions

View File

@ -24,6 +24,7 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
* Return HTTP 500 for GET /_matrix/push/v1/notify when base-url is not configured (no ticket) * Return HTTP 500 for GET /_matrix/push/v1/notify when base-url is not configured (no ticket)
* Disallow setting `upstream-base-url` to the same value as `base-url` ([#334](https://github.com/binwiederhier/ntfy/issues/334), thanks to [@oester](https://github.com/oester) for reporting) * Disallow setting `upstream-base-url` to the same value as `base-url` ([#334](https://github.com/binwiederhier/ntfy/issues/334), thanks to [@oester](https://github.com/oester) for reporting)
* Fix `since=<id>` implementation for multiple topics ([#336](https://github.com/binwiederhier/ntfy/issues/336), thanks to [@karmanyaahm](https://github.com/karmanyaahm) for reporting) * Fix `since=<id>` implementation for multiple topics ([#336](https://github.com/binwiederhier/ntfy/issues/336), thanks to [@karmanyaahm](https://github.com/karmanyaahm) for reporting)
* Simple parsing in `Actions` header now supports settings Android `intent=` key ([#341](https://github.com/binwiederhier/ntfy/pull/341), thanks to [@wunter8](https://github.com/wunter8))
## ntfy Android app v1.14.0 (UNRELEASED) ## ntfy Android app v1.14.0 (UNRELEASED)

View File

@ -186,8 +186,8 @@ func populateAction(newAction *action, section int, key, value string) error {
newAction.Method = value newAction.Method = value
case "body": case "body":
newAction.Body = value newAction.Body = value
case "intent": case "intent":
newAction.Intent = value newAction.Intent = value
default: default:
return fmt.Errorf("key '%s' unknown", key) return fmt.Errorf("key '%s' unknown", key)
} }

View File

@ -52,13 +52,13 @@ func TestParseActions(t *testing.T) {
require.Equal(t, "some command", actions[0].Extras["command"]) require.Equal(t, "some command", actions[0].Extras["command"])
require.Equal(t, "a parameter", actions[0].Extras["some_param"]) require.Equal(t, "a parameter", actions[0].Extras["some_param"])
// Broadcast action with intent // Broadcast action with intent
actions, err = parseActions("action=broadcast, label=Do a thing, intent=io.heckel.ntfy.TEST_INTENT") actions, err = parseActions("action=broadcast, label=Do a thing, intent=io.heckel.ntfy.TEST_INTENT")
require.Nil(t, err) require.Nil(t, err)
require.Equal(t, 1, len(actions)) require.Equal(t, 1, len(actions))
require.Equal(t, "broadcast", actions[0].Action) require.Equal(t, "broadcast", actions[0].Action)
require.Equal(t, "Do a thing", actions[0].Label) require.Equal(t, "Do a thing", actions[0].Label)
require.Equal(t, "io.heckel.ntfy.TEST_INTENT", actions[0].Intent) require.Equal(t, "io.heckel.ntfy.TEST_INTENT", actions[0].Intent)
// Headers with dashes // Headers with dashes
actions, err = parseActions("action=http, label=Send request, url=http://example.com, method=GET, headers.Content-Type=application/json, headers.Authorization=Basic sdasffsf") actions, err = parseActions("action=http, label=Send request, url=http://example.com, method=GET, headers.Content-Type=application/json, headers.Authorization=Basic sdasffsf")