diff --git a/example/composition.yaml b/example/composition.yaml index e951408..67b828e 100644 --- a/example/composition.yaml +++ b/example/composition.yaml @@ -15,7 +15,7 @@ spec: apiVersion: kndp.io/v1alpha1 kind: Poll providerConfigRef: "kndp-kubernetes-provider-config" - deploymentImage: "ghcr.io/kndpio/function-poll/slack-collector:c9def" - cronJobImage: "ghcr.io/kndpio/function-poll/slack-notify:c9def" + deploymentImage: "ghcr.io/kndpio/function-poll/slack-collector:d7a4b" + cronJobImage: "ghcr.io/kndpio/function-poll/slack-notify:d7a4b" deploymentName: "slack-collector" serviceAccountName: "slack-collector" \ No newline at end of file diff --git a/example/functions.yaml b/example/functions.yaml index a15e09a..e9d0831 100644 --- a/example/functions.yaml +++ b/example/functions.yaml @@ -8,6 +8,6 @@ metadata: # render.crossplane.io/runtime: Development spec: # This is ignored when using the Development runtime. - package: ghcr.io/kndpio/function-poll:c9def + package: ghcr.io/kndpio/function-poll:d7a4b runtimeConfigRef: name: poll-function-runtime \ No newline at end of file diff --git a/example/rbac.yaml b/example/rbac.yaml index a4247e2..d61162a 100644 --- a/example/rbac.yaml +++ b/example/rbac.yaml @@ -15,6 +15,9 @@ rules: - apiGroups: ["kndp.io"] resources: ["polls"] verbs: ["*"] +- apiGroups: ["kndp.io"] + resources: ["polls/status"] + verbs: ["*"] - apiGroups: ["v1"] resources: ["services"] verbs: ["*"] diff --git a/example/xr.yaml b/example/xr.yaml index 1576388..123fcd9 100644 --- a/example/xr.yaml +++ b/example/xr.yaml @@ -4,7 +4,7 @@ metadata: name: meal spec: deliveryTime: 0 - dueOrderTime: 10 + dueOrderTime: 15 dueTakeTime: 0 voters: [] title: "meal" diff --git a/internal/slack-collector/main.go b/internal/slack-collector/main.go index 945fb41..50a8fe0 100644 --- a/internal/slack-collector/main.go +++ b/internal/slack-collector/main.go @@ -71,9 +71,10 @@ type Poll struct { } var ( - api = slack.New(os.Getenv("SLACK_API_TOKEN")) - path = os.Getenv("SLACK_COLLECTOR_PATH") - port = os.Getenv("SLACK_COLLECTOR_PORT") + api = slack.New(os.Getenv("SLACK_API_TOKEN")) + path = os.Getenv("SLACK_COLLECTOR_PATH") + port = os.Getenv("SLACK_COLLECTOR_PORT") + response string ) // handleEventsEndpoint handles the events endpoint. @@ -114,7 +115,7 @@ func patchVoterStatus(user, pollSlackName, selectedOption string, dynamicClient if err != nil { return err } - + response = pollResource.Spec.Messages.Response foundUser := false for i := range pollResource.Spec.Voters { if pollResource.Spec.Voters[i].Name == user { @@ -170,7 +171,7 @@ func respondMsg(userID string, userName string, selectedOption string, pollName attachment := slack.Attachment{ Color: "#f9a41b", CallbackID: pollName, - Text: "\n Selected: " + selectedOption, + Text: response + "\n Selected: " + selectedOption, Fields: []slack.AttachmentField{}, Actions: []slack.AttachmentAction{}, MarkdownIn: []string{},