mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: turn off notification via email (#14520)
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
<div style="border-top: 1px solid #e2e8f0; color: #475569; font-size: 12px; margin-top: 64px; padding-top: 24px; line-height: 1.6;">
|
||||
<p>© {{ current_year }} Coder. All rights reserved - <a href="{{ base_url }}" style="color: #2563eb; text-decoration: none;">{{ base_url }}</a></p>
|
||||
<p><a href="{{ base_url }}/settings/notifications" style="color: #2563eb; text-decoration: none;">Click here to manage your notification settings</a></p>
|
||||
<p><a href="{{ base_url }}/settings/notifications?disabled={{ .NotificationTemplateID }}" style="color: #2563eb; text-decoration: none;">Stop receiving emails like this</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -121,9 +121,10 @@ func (s *StoreEnqueuer) Enqueue(ctx context.Context, userID, templateID uuid.UUI
|
||||
// actions which can be taken by the recipient.
|
||||
func (s *StoreEnqueuer) buildPayload(metadata database.FetchNewMessageMetadataRow, labels map[string]string) (*types.MessagePayload, error) {
|
||||
payload := types.MessagePayload{
|
||||
Version: "1.0",
|
||||
Version: "1.1",
|
||||
|
||||
NotificationName: metadata.NotificationName,
|
||||
NotificationName: metadata.NotificationName,
|
||||
NotificationTemplateID: metadata.NotificationTemplateID.String(),
|
||||
|
||||
UserID: metadata.UserID.String(),
|
||||
UserEmail: metadata.UserEmail,
|
||||
|
||||
@@ -56,6 +56,15 @@ func TestGoTemplate(t *testing.T) {
|
||||
"url": "https://mocked-server-address/@johndoe/my-workspace"
|
||||
}]`,
|
||||
},
|
||||
{
|
||||
name: "render notification template ID",
|
||||
in: `{{ .NotificationTemplateID }}`,
|
||||
payload: types.MessagePayload{
|
||||
NotificationTemplateID: "4e19c0ac-94e1-4532-9515-d1801aa283b2",
|
||||
},
|
||||
expectedOutput: "4e19c0ac-94e1-4532-9515-d1801aa283b2",
|
||||
expectedErr: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
|
||||
@@ -7,7 +7,8 @@ package types
|
||||
type MessagePayload struct {
|
||||
Version string `json:"_version"`
|
||||
|
||||
NotificationName string `json:"notification_name"`
|
||||
NotificationName string `json:"notification_name"`
|
||||
NotificationTemplateID string `json:"notification_template_id"`
|
||||
|
||||
UserID string `json:"user_id"`
|
||||
UserEmail string `json:"user_email"`
|
||||
|
||||
Reference in New Issue
Block a user