Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8d9a80

Browse files
authored
feat: add notification warning alert to Tasks page (#20900)
## ProblemUsers may not realize that task notifications are disabled by default.To improve awareness, we show a warning alert on the Tasks page when alltask notifications are disabled.**Alert visibility logic:**- Shows when **all** task notification templates (Task Working, TaskIdle, Task Completed, Task Failed) are disabled- Can be dismissed by the user, which stores the dismissal in the userpreferences API- If the user later enables any task notification in Account Settings,the dismissal state is cleared so the alert will show again if theydisable all notifications in the future<img width="2980" height="1588" alt="Screenshot 2025-11-25 at 17 48 17"src="https://github.com/user-attachments/assets/316bf097-d9d2-4489-bc16-2987ba45f45c"/>## Changes- Added a warning alert to the Tasks page when all task notificationsare disabled- Introduced new `/users/{user}/preferences` endpoint to manage userpreferences (stored in `user_configs` table)- Alert is dismissible and stores the dismissal state via the new userpreferences API endpoint- Enabling any task notification in Account Settings clears thedismissal state via the preferences API- Added comprehensive Storybook stories for both TasksPage andNotificationsPage to test all alert visibility states and interactionsCloses:coder/internal#1089
1 parenta8862be commitf8d9a80

File tree

24 files changed

+1028
-40
lines changed

24 files changed

+1028
-40
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/coderd.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,8 @@ func New(options *Options) *API {
13361336
})
13371337
r.Get("/appearance",api.userAppearanceSettings)
13381338
r.Put("/appearance",api.putUserAppearanceSettings)
1339+
r.Get("/preferences",api.userPreferenceSettings)
1340+
r.Put("/preferences",api.putUserPreferenceSettings)
13391341
r.Route("/password",func(r chi.Router) {
13401342
r.Use(httpmw.RateLimit(options.LoginRateLimit,time.Minute))
13411343
r.Put("/",api.putUserPassword)

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3431,6 +3431,17 @@ func (q *querier) GetUserStatusCounts(ctx context.Context, arg database.GetUserS
34313431
returnq.db.GetUserStatusCounts(ctx,arg)
34323432
}
34333433

3434+
func (q*querier)GetUserTaskNotificationAlertDismissed(ctx context.Context,userID uuid.UUID) (bool,error) {
3435+
user,err:=q.db.GetUserByID(ctx,userID)
3436+
iferr!=nil {
3437+
returnfalse,err
3438+
}
3439+
iferr:=q.authorizeContext(ctx,policy.ActionReadPersonal,user);err!=nil {
3440+
returnfalse,err
3441+
}
3442+
returnq.db.GetUserTaskNotificationAlertDismissed(ctx,userID)
3443+
}
3444+
34343445
func (q*querier)GetUserTerminalFont(ctx context.Context,userID uuid.UUID) (string,error) {
34353446
u,err:=q.db.GetUserByID(ctx,userID)
34363447
iferr!=nil {
@@ -5464,6 +5475,17 @@ func (q *querier) UpdateUserStatus(ctx context.Context, arg database.UpdateUserS
54645475
returnupdateWithReturn(q.log,q.auth,fetch,q.db.UpdateUserStatus)(ctx,arg)
54655476
}
54665477

5478+
func (q*querier)UpdateUserTaskNotificationAlertDismissed(ctx context.Context,arg database.UpdateUserTaskNotificationAlertDismissedParams) (bool,error) {
5479+
user,err:=q.db.GetUserByID(ctx,arg.UserID)
5480+
iferr!=nil {
5481+
returnfalse,err
5482+
}
5483+
iferr:=q.authorizeContext(ctx,policy.ActionUpdatePersonal,user);err!=nil {
5484+
returnfalse,err
5485+
}
5486+
returnq.db.UpdateUserTaskNotificationAlertDismissed(ctx,arg)
5487+
}
5488+
54675489
func (q*querier)UpdateUserTerminalFont(ctx context.Context,arg database.UpdateUserTerminalFontParams) (database.UserConfig,error) {
54685490
u,err:=q.db.GetUserByID(ctx,arg.UserID)
54695491
iferr!=nil {

‎coderd/database/dbauthz/dbauthz_test.go‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"net"
99
"reflect"
10+
"strconv"
1011
"testing"
1112
"time"
1213

@@ -1477,6 +1478,21 @@ func (s *MethodTestSuite) TestUser() {
14771478
dbm.EXPECT().UpdateUserTerminalFont(gomock.Any(),arg).Return(uc,nil).AnyTimes()
14781479
check.Args(arg).Asserts(u,policy.ActionUpdatePersonal).Returns(uc)
14791480
}))
1481+
s.Run("GetUserTaskNotificationAlertDismissed",s.Mocked(func(dbm*dbmock.MockStore,faker*gofakeit.Faker,check*expects) {
1482+
u:=testutil.Fake(s.T(),faker, database.User{})
1483+
dbm.EXPECT().GetUserByID(gomock.Any(),u.ID).Return(u,nil).AnyTimes()
1484+
dbm.EXPECT().GetUserTaskNotificationAlertDismissed(gomock.Any(),u.ID).Return(false,nil).AnyTimes()
1485+
check.Args(u.ID).Asserts(u,policy.ActionReadPersonal).Returns(false)
1486+
}))
1487+
s.Run("UpdateUserTaskNotificationAlertDismissed",s.Mocked(func(dbm*dbmock.MockStore,faker*gofakeit.Faker,check*expects) {
1488+
user:=testutil.Fake(s.T(),faker, database.User{})
1489+
userConfig:= database.UserConfig{UserID:user.ID,Key:"task_notification_alert_dismissed",Value:"false"}
1490+
userConfigValue,_:=strconv.ParseBool(userConfig.Value)
1491+
arg:= database.UpdateUserTaskNotificationAlertDismissedParams{UserID:user.ID,TaskNotificationAlertDismissed:userConfigValue}
1492+
dbm.EXPECT().GetUserByID(gomock.Any(),user.ID).Return(user,nil).AnyTimes()
1493+
dbm.EXPECT().UpdateUserTaskNotificationAlertDismissed(gomock.Any(),arg).Return(false,nil).AnyTimes()
1494+
check.Args(arg).Asserts(user,policy.ActionUpdatePersonal).Returns(userConfigValue)
1495+
}))
14801496
s.Run("UpdateUserStatus",s.Mocked(func(dbm*dbmock.MockStore,faker*gofakeit.Faker,check*expects) {
14811497
u:=testutil.Fake(s.T(),faker, database.User{})
14821498
arg:= database.UpdateUserStatusParams{ID:u.ID,Status:u.Status,UpdatedAt:u.UpdatedAt}

‎coderd/database/dbmetrics/querymetrics.go‎

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dbmock/dbmock.go‎

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/querier.go‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp