summaryrefslogtreecommitdiff
path: root/notifications.go
diff options
context:
space:
mode:
authorJan Dittberner <jandd@cacert.org>2017-04-21 11:31:32 +0200
committerJan Dittberner <jan@dittberner.info>2017-04-22 00:14:11 +0200
commit8d1f18e16dcf44001155e8dff273f82900899d76 (patch)
tree6a7ed46e5ffb339cc316f9d862f6584d2aa82776 /notifications.go
parent2cac50ee86e70428aa06c99f5e009ceaaf1dbc13 (diff)
downloadcacert-boardvoting-8d1f18e16dcf44001155e8dff273f82900899d76.tar.gz
cacert-boardvoting-8d1f18e16dcf44001155e8dff273f82900899d76.tar.xz
cacert-boardvoting-8d1f18e16dcf44001155e8dff273f82900899d76.zip
Implement direct voting
Diffstat (limited to 'notifications.go')
-rw-r--r--notifications.go31
1 files changed, 29 insertions, 2 deletions
diff --git a/notifications.go b/notifications.go
index 499a689..4a76710 100644
--- a/notifications.go
+++ b/notifications.go
@@ -113,7 +113,7 @@ type NotificationCreateMotion struct {
}
func (n *NotificationCreateMotion) GetData() interface{} {
- voteURL := fmt.Sprintf("%s/vote", config.BaseURL)
+ voteURL := fmt.Sprintf("%s/vote/%s", config.BaseURL, n.decision.Tag)
unvotedURL := fmt.Sprintf("%s/motions/?unvoted=1", config.BaseURL)
return struct {
*Decision
@@ -146,7 +146,7 @@ func NewNotificationUpdateMotion(decision Decision, voter Voter) *NotificationUp
}
func (n *NotificationUpdateMotion) GetData() interface{} {
- voteURL := fmt.Sprintf("%s/vote", config.BaseURL)
+ voteURL := fmt.Sprintf("%s/vote/%s", config.BaseURL, n.decision.Tag)
unvotedURL := fmt.Sprintf("%s/motions/?unvoted=1", config.BaseURL)
return struct {
*Decision
@@ -250,3 +250,30 @@ func (n *NotificationProxyVote) GetTemplate() string { return "proxy_vote_mail.t
func (n *NotificationProxyVote) GetSubject() string {
return fmt.Sprintf("Re: %s - %s", n.decision.Tag, n.decision.Title)
}
+
+type NotificationDirectVote struct {
+ voteNotificationBase
+ decisionReplyBase
+ voter Voter
+ vote Vote
+}
+
+func NewNotificationDirectVote(decision *Decision, voter *Voter, vote *Vote) *NotificationDirectVote {
+ notification := &NotificationDirectVote{voter: *voter, vote: *vote}
+ notification.decision = *decision
+ return notification
+}
+
+func (n *NotificationDirectVote) GetData() interface{} {
+ return struct {
+ Vote VoteChoice
+ Voter string
+ Decision *Decision
+ }{n.vote.Vote, n.voter.Name, &n.decision}
+}
+
+func (n *NotificationDirectVote) GetTemplate() string { return "direct_vote_mail.txt" }
+
+func (n *NotificationDirectVote) GetSubject() string {
+ return fmt.Sprintf("Re: %s - %s", n.decision.Tag, n.decision.Title)
+}