Skip to content

Commit 9f1f4f9

Browse files
committed
push notification -> webpush
1 parent 0535ed6 commit 9f1f4f9

40 files changed

+701
-704
lines changed

cli/server_regenerate_vapid_keypair_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestRegenerateVapidKeypair(t *testing.T) {
3636

3737
db := database.New(sqlDB)
3838
// Ensure there is no existing VAPID keypair.
39-
rows, err := db.GetNotificationVAPIDKeys(ctx)
39+
rows, err := db.GetWebpushVAPIDKeys(ctx)
4040
require.NoError(t, err)
4141
require.Empty(t, rows)
4242

@@ -48,13 +48,13 @@ func TestRegenerateVapidKeypair(t *testing.T) {
4848
clitest.Start(t, inv)
4949

5050
pty.ExpectMatchContext(ctx, "Regenerating VAPID keypair...")
51-
pty.ExpectMatchContext(ctx, "This will delete all existing push notification subscriptions.")
51+
pty.ExpectMatchContext(ctx, "This will delete all existing webpush subscriptions.")
5252
pty.ExpectMatchContext(ctx, "Are you sure you want to continue? (y/N)")
5353
pty.WriteLine("y")
5454
pty.ExpectMatchContext(ctx, "VAPID keypair regenerated successfully.")
5555

5656
// Ensure the VAPID keypair was created.
57-
keys, err := db.GetNotificationVAPIDKeys(ctx)
57+
keys, err := db.GetWebpushVAPIDKeys(ctx)
5858
require.NoError(t, err)
5959
require.NotEmpty(t, keys.VapidPublicKey)
6060
require.NotEmpty(t, keys.VapidPrivateKey)
@@ -79,7 +79,7 @@ func TestRegenerateVapidKeypair(t *testing.T) {
7979
u := dbgen.User(t, db, database.User{})
8080
// Insert a few fake push subscriptions for each user.
8181
for j := 0; j < 10; j++ {
82-
_ = dbgen.NotificationPushSubscription(t, db, database.InsertNotificationPushSubscriptionParams{
82+
_ = dbgen.WebpushSubscription(t, db, database.InsertWebpushSubscriptionParams{
8383
UserID: u.ID,
8484
})
8585
}
@@ -93,20 +93,20 @@ func TestRegenerateVapidKeypair(t *testing.T) {
9393
clitest.Start(t, inv)
9494

9595
pty.ExpectMatchContext(ctx, "Regenerating VAPID keypair...")
96-
pty.ExpectMatchContext(ctx, "This will delete all existing push notification subscriptions.")
96+
pty.ExpectMatchContext(ctx, "This will delete all existing webpush subscriptions.")
9797
pty.ExpectMatchContext(ctx, "Are you sure you want to continue? (y/N)")
9898
pty.WriteLine("y")
9999
pty.ExpectMatchContext(ctx, "VAPID keypair regenerated successfully.")
100100

101101
// Ensure the VAPID keypair was created.
102-
keys, err := db.GetNotificationVAPIDKeys(ctx)
102+
keys, err := db.GetWebpushVAPIDKeys(ctx)
103103
require.NoError(t, err)
104104
require.NotEmpty(t, keys.VapidPublicKey)
105105
require.NotEmpty(t, keys.VapidPrivateKey)
106106

107107
// Ensure the push subscriptions were deleted.
108108
var count int64
109-
rows, err := sqlDB.QueryContext(ctx, "SELECT COUNT(*) FROM notification_push_subscriptions")
109+
rows, err := sqlDB.QueryContext(ctx, "SELECT COUNT(*) FROM webpush_subscriptions")
110110
require.NoError(t, err)
111111
t.Cleanup(func() {
112112
_ = rows.Close()

coderd/apidoc/docs.go

+24-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+24-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -577,16 +577,16 @@ func New(options *Options) *API {
577577
api.AppearanceFetcher.Store(&f)
578578
api.PortSharer.Store(&portsharing.DefaultPortSharer)
579579
buildInfo := codersdk.BuildInfoResponse{
580-
ExternalURL: buildinfo.ExternalURL(),
581-
Version: buildinfo.Version(),
582-
AgentAPIVersion: AgentAPIVersionREST,
583-
ProvisionerAPIVersion: proto.CurrentVersion.String(),
584-
DashboardURL: api.AccessURL.String(),
585-
WorkspaceProxy: false,
586-
UpgradeMessage: api.DeploymentValues.CLIUpgradeMessage.String(),
587-
DeploymentID: api.DeploymentID,
588-
PushNotificationsPublicKey: api.PushNotifier.PublicKey(),
589-
Telemetry: api.Telemetry.Enabled(),
580+
ExternalURL: buildinfo.ExternalURL(),
581+
Version: buildinfo.Version(),
582+
AgentAPIVersion: AgentAPIVersionREST,
583+
ProvisionerAPIVersion: proto.CurrentVersion.String(),
584+
DashboardURL: api.AccessURL.String(),
585+
WorkspaceProxy: false,
586+
UpgradeMessage: api.DeploymentValues.CLIUpgradeMessage.String(),
587+
DeploymentID: api.DeploymentID,
588+
WebPushPublicKey: api.PushNotifier.PublicKey(),
589+
Telemetry: api.Telemetry.Enabled(),
590590
}
591591
api.SiteHandler = site.New(&site.Options{
592592
BinFS: binFS,
@@ -1201,8 +1201,8 @@ func New(options *Options) *API {
12011201
r.Put("/", api.putUserNotificationPreferences)
12021202
})
12031203
r.Route("/push", func(r chi.Router) {
1204-
r.Post("/subscription", api.postUserPushNotificationSubscription)
1205-
r.Delete("/subscription", api.deleteUserPushNotificationSubscription)
1204+
r.Post("/subscription", api.postUserWebpushSubscription)
1205+
r.Delete("/subscription", api.deleteUserWebpushSubscription)
12061206
r.Post("/test", api.postUserPushNotificationTest)
12071207
})
12081208
})

0 commit comments

Comments
 (0)