Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect target for user notifications #1397

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions model/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ const (
// Notification is a message (e.g. a feature alert) that is displayed to users
type Notification struct {
Model

Title *string `json:"title,omitempty"`
Body string `json:"-" gorm:"not null"`
Target NotificationTarget `json:"-" gorm:"not null; default:1"`
Target NotificationTarget `json:"target" gorm:"not null; default:1"`

// SanitizedBody is the body of the notification, converted from markdown to HTML
SanitizedBody string `json:"body" gorm:"-"`
Expand Down
6 changes: 5 additions & 1 deletion web/ts/notification-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export function createNotification(body: string, target: number, title: string |
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(notification),
body: JSON.stringify({
title: notification.title,
body: notification.body,
target: Number(notification.target),
}),
})
.then((r) => r.json())
.then((r) => {
Expand Down
Loading