From b4a824aa3891cbe857ffa9f76dd3d3b23edf835d Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Wed, 22 Jun 2022 20:23:15 -0400 Subject: [PATCH] Format actions PR, changelog --- docs/releases.md | 1 + server/actions.go | 4 ++-- server/actions_test.go | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/releases.md b/docs/releases.md index 9998bc79..ebff6955 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -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) * 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=` 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) diff --git a/server/actions.go b/server/actions.go index 374e8bcc..6102febd 100644 --- a/server/actions.go +++ b/server/actions.go @@ -186,8 +186,8 @@ func populateAction(newAction *action, section int, key, value string) error { newAction.Method = value case "body": newAction.Body = value - case "intent": - newAction.Intent = value + case "intent": + newAction.Intent = value default: return fmt.Errorf("key '%s' unknown", key) } diff --git a/server/actions_test.go b/server/actions_test.go index 1a949b3f..2a6c4b15 100644 --- a/server/actions_test.go +++ b/server/actions_test.go @@ -52,13 +52,13 @@ func TestParseActions(t *testing.T) { require.Equal(t, "some command", actions[0].Extras["command"]) require.Equal(t, "a parameter", actions[0].Extras["some_param"]) - // Broadcast action with intent - actions, err = parseActions("action=broadcast, label=Do a thing, intent=io.heckel.ntfy.TEST_INTENT") - require.Nil(t, err) - require.Equal(t, 1, len(actions)) - require.Equal(t, "broadcast", actions[0].Action) - require.Equal(t, "Do a thing", actions[0].Label) - require.Equal(t, "io.heckel.ntfy.TEST_INTENT", actions[0].Intent) + // Broadcast action with intent + actions, err = parseActions("action=broadcast, label=Do a thing, intent=io.heckel.ntfy.TEST_INTENT") + require.Nil(t, err) + require.Equal(t, 1, len(actions)) + require.Equal(t, "broadcast", actions[0].Action) + require.Equal(t, "Do a thing", actions[0].Label) + require.Equal(t, "io.heckel.ntfy.TEST_INTENT", actions[0].Intent) // 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")