Skip to content

feat: add killswitch for notifications #13794

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

Merged
merged 22 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove test for not modified
  • Loading branch information
mtojek committed Jul 10, 2024
commit da6775f8c4543ac63371265cd869e5514257eece
20 changes: 0 additions & 20 deletions coderd/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,4 @@ func TestUpdateNotificationsSettings(t *testing.T) {
require.NoError(t, err)
require.Equal(t, expected, actual)
})

t.Run("Settings not modified", func(t *testing.T) {
t.Parallel()

client := coderdtest.New(t, nil)
_ = coderdtest.CreateFirstUser(t, client)

ctx := testutil.Context(t, testutil.WaitShort)

// given
expected := codersdk.NotificationsSettings{
NotifierPaused: false,
}
err := client.PutNotificationsSettings(ctx, expected)
require.NoError(t, err)

// then
err = client.PutNotificationsSettings(ctx, expected)
require.Error(t, err) // Error: notifications settings not modified
})
}
4 changes: 1 addition & 3 deletions codersdk/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"encoding/json"
"net/http"

"golang.org/x/xerrors"
)

type NotificationsSettings struct {
Expand Down Expand Up @@ -33,7 +31,7 @@ func (c *Client) PutNotificationsSettings(ctx context.Context, settings Notifica
defer res.Body.Close()

if res.StatusCode == http.StatusNotModified {
return xerrors.New("notifications settings not modified")
return nil
}
if res.StatusCode != http.StatusOK {
return ReadBodyAsError(res)
Expand Down
Loading