summaryrefslogtreecommitdiff
path: root/notifications.go
diff options
context:
space:
mode:
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)
+}