Skip to content

Commit e164b1e

Browse files
authored
feat: add notification preferences database & audit support (coder#14100)
1 parent 49a2880 commit e164b1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3229
-368
lines changed

cli/notifications_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ import (
1616
"github.com/coder/coder/v2/testutil"
1717
)
1818

19+
func createOpts(t *testing.T) *coderdtest.Options {
20+
t.Helper()
21+
22+
dt := coderdtest.DeploymentValues(t)
23+
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
24+
return &coderdtest.Options{
25+
DeploymentValues: dt,
26+
}
27+
}
28+
1929
func TestNotifications(t *testing.T) {
2030
t.Parallel()
2131

@@ -42,7 +52,7 @@ func TestNotifications(t *testing.T) {
4252
t.Parallel()
4353

4454
// given
45-
ownerClient, db := coderdtest.NewWithDatabase(t, nil)
55+
ownerClient, db := coderdtest.NewWithDatabase(t, createOpts(t))
4656
_ = coderdtest.CreateFirstUser(t, ownerClient)
4757

4858
// when
@@ -72,7 +82,7 @@ func TestPauseNotifications_RegularUser(t *testing.T) {
7282
t.Parallel()
7383

7484
// given
75-
ownerClient, db := coderdtest.NewWithDatabase(t, nil)
85+
ownerClient, db := coderdtest.NewWithDatabase(t, createOpts(t))
7686
owner := coderdtest.CreateFirstUser(t, ownerClient)
7787
anotherClient, _ := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID)
7888

@@ -87,7 +97,7 @@ func TestPauseNotifications_RegularUser(t *testing.T) {
8797
require.Error(t, err)
8898
require.ErrorAsf(t, err, &sdkError, "error should be of type *codersdk.Error")
8999
assert.Equal(t, http.StatusForbidden, sdkError.StatusCode())
90-
assert.Contains(t, sdkError.Message, "Insufficient permissions to update notifications settings.")
100+
assert.Contains(t, sdkError.Message, "Forbidden.")
91101

92102
// then
93103
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)

coderd/apidoc/docs.go

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

0 commit comments

Comments
 (0)