mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: notifications: use username in workspace URLs (#14011)
This commit is contained in:
@@ -1929,6 +1929,7 @@ func (q *FakeQuerier) FetchNewMessageMetadata(_ context.Context, arg database.Fe
|
||||
return database.FetchNewMessageMetadataRow{
|
||||
UserEmail: user.Email,
|
||||
UserName: userName,
|
||||
UserUsername: user.Username,
|
||||
NotificationName: "Some notification",
|
||||
Actions: actions,
|
||||
UserID: arg.UserID,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
UPDATE notification_templates
|
||||
SET
|
||||
actions = REPLACE(actions::text, '@{{.UserUsername}}', '@{{.UserName}}')::jsonb;
|
||||
@@ -0,0 +1,3 @@
|
||||
UPDATE notification_templates
|
||||
SET
|
||||
actions = REPLACE(actions::text, '@{{.UserName}}', '@{{.UserUsername}}')::jsonb;
|
||||
@@ -3546,7 +3546,8 @@ SELECT nt.name AS notificatio
|
||||
nt.actions AS actions,
|
||||
u.id AS user_id,
|
||||
u.email AS user_email,
|
||||
COALESCE(NULLIF(u.name, ''), NULLIF(u.username, ''))::text AS user_name
|
||||
COALESCE(NULLIF(u.name, ''), NULLIF(u.username, ''))::text AS user_name,
|
||||
COALESCE(u.username, '') AS user_username
|
||||
FROM notification_templates nt,
|
||||
users u
|
||||
WHERE nt.id = $1
|
||||
@@ -3564,6 +3565,7 @@ type FetchNewMessageMetadataRow struct {
|
||||
UserID uuid.UUID `db:"user_id" json:"user_id"`
|
||||
UserEmail string `db:"user_email" json:"user_email"`
|
||||
UserName string `db:"user_name" json:"user_name"`
|
||||
UserUsername string `db:"user_username" json:"user_username"`
|
||||
}
|
||||
|
||||
// This is used to build up the notification_message's JSON payload.
|
||||
@@ -3576,6 +3578,7 @@ func (q *sqlQuerier) FetchNewMessageMetadata(ctx context.Context, arg FetchNewMe
|
||||
&i.UserID,
|
||||
&i.UserEmail,
|
||||
&i.UserName,
|
||||
&i.UserUsername,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ SELECT nt.name AS notificatio
|
||||
nt.actions AS actions,
|
||||
u.id AS user_id,
|
||||
u.email AS user_email,
|
||||
COALESCE(NULLIF(u.name, ''), NULLIF(u.username, ''))::text AS user_name
|
||||
COALESCE(NULLIF(u.name, ''), NULLIF(u.username, ''))::text AS user_name,
|
||||
COALESCE(u.username, '') AS user_username
|
||||
FROM notification_templates nt,
|
||||
users u
|
||||
WHERE nt.id = @notification_template_id
|
||||
|
||||
Reference in New Issue
Block a user