summaryrefslogtreecommitdiff
path: root/actions.go
diff options
context:
space:
mode:
authorJan Dittberner <jan@dittberner.info>2017-04-18 20:30:08 +0200
committerJan Dittberner <jan@dittberner.info>2017-04-22 00:12:38 +0200
commitcc0f5c0b7b931440704bc31a858d52ae92585616 (patch)
tree970642e2f5d69ec9213084cc938efdec8bd07673 /actions.go
parentbcfbad42b66aa29f85b283dc9aed362d3ff97f84 (diff)
downloadcacert-boardvoting-cc0f5c0b7b931440704bc31a858d52ae92585616.tar.gz
cacert-boardvoting-cc0f5c0b7b931440704bc31a858d52ae92585616.tar.xz
cacert-boardvoting-cc0f5c0b7b931440704bc31a858d52ae92585616.zip
Implement motion creation mail template
Diffstat (limited to 'actions.go')
-rw-r--r--actions.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/actions.go b/actions.go
index 190314c..0619587 100644
--- a/actions.go
+++ b/actions.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"github.com/Masterminds/sprig"
"os"
"text/template"
@@ -14,7 +15,29 @@ func CreateMotion(decision *Decision, voter *Voter) (err error) {
return
}
- // TODO: implement fetching new decision, implement mail
+ type mailContext struct {
+ Decision
+ Name string
+ Sender string
+ Recipient string
+ VoteURL string
+ UnvotedURL string
+ }
+ voteURL := fmt.Sprintf("%s/vote", config.BaseURL)
+ unvotedURL := fmt.Sprintf("%s/motions/?unvoted=1", config.BaseURL)
+ context := mailContext{
+ *decision, voter.Name, config.NoticeSenderAddress,
+ config.BoardMailAddress, voteURL,
+ unvotedURL}
+
+ t, err := template.New("create_motion_mail.txt").Funcs(
+ sprig.GenericFuncMap()).ParseFiles("templates/create_motion_mail.txt")
+ if err != nil {
+ logger.Fatal(err)
+ }
+ t.Execute(os.Stdout, context)
+
+ // TODO: implement mail sending
return
}