mirror of
https://github.com/coder/coder.git
synced 2026-06-06 14:38:23 +00:00
70d6efa311
Depends on #24642 Adds per-owner digest notifications onto the chat auto-archive subsystem. Each tick's archived rows are grouped by owner, the top 25 titles per owner are rendered into a new `Chats Auto-Archived` notification template, and any remainder surfaces as `and N more`. Each digest is per-tick, so users with large amounts of purgeable data may get multiple notifications in sequence (one per user per tick). The template body branches on `retention_days`: when retention is disabled (`retention_days=0`), users are told archived chats are kept indefinitely rather than falsely claiming imminent deletion. ### Changes - migration `000XXX_chat_auto_archive_notification_template` adds new notification template - `dbpurge`: threads `notifications.Enqueuer` through `New`; and enqueues notification message. - `cli/server.go`: passes `options.NotificationsEnqueuer` into `dbpurge.New`. - `coderd/notifications/events.go`: new `TemplateChatAutoArchiveDigest` UUID. - `coderd/inboxnotifications.go`: inbox registration. - Docs: adds a `Notifications` section to `chat-auto-archive.md`. > 🤖
83 lines
2.9 KiB
Go
83 lines
2.9 KiB
Go
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: github.com/coder/coder/v2/coderd/notifications (interfaces: Enqueuer)
|
|
//
|
|
// Generated by this command:
|
|
//
|
|
// mockgen -destination ./notificationsmock.go -package notificationsmock github.com/coder/coder/v2/coderd/notifications Enqueuer
|
|
//
|
|
|
|
// Package notificationsmock is a generated GoMock package.
|
|
package notificationsmock
|
|
|
|
import (
|
|
context "context"
|
|
reflect "reflect"
|
|
|
|
uuid "github.com/google/uuid"
|
|
gomock "go.uber.org/mock/gomock"
|
|
)
|
|
|
|
// MockEnqueuer is a mock of Enqueuer interface.
|
|
type MockEnqueuer struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockEnqueuerMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockEnqueuerMockRecorder is the mock recorder for MockEnqueuer.
|
|
type MockEnqueuerMockRecorder struct {
|
|
mock *MockEnqueuer
|
|
}
|
|
|
|
// NewMockEnqueuer creates a new mock instance.
|
|
func NewMockEnqueuer(ctrl *gomock.Controller) *MockEnqueuer {
|
|
mock := &MockEnqueuer{ctrl: ctrl}
|
|
mock.recorder = &MockEnqueuerMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockEnqueuer) EXPECT() *MockEnqueuerMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Enqueue mocks base method.
|
|
func (m *MockEnqueuer) Enqueue(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, createdBy string, targets ...uuid.UUID) ([]uuid.UUID, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, userID, templateID, labels, createdBy}
|
|
for _, a := range targets {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Enqueue", varargs...)
|
|
ret0, _ := ret[0].([]uuid.UUID)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Enqueue indicates an expected call of Enqueue.
|
|
func (mr *MockEnqueuerMockRecorder) Enqueue(ctx, userID, templateID, labels, createdBy any, targets ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, userID, templateID, labels, createdBy}, targets...)
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Enqueue", reflect.TypeOf((*MockEnqueuer)(nil).Enqueue), varargs...)
|
|
}
|
|
|
|
// EnqueueWithData mocks base method.
|
|
func (m *MockEnqueuer) EnqueueWithData(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, data map[string]any, createdBy string, targets ...uuid.UUID) ([]uuid.UUID, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, userID, templateID, labels, data, createdBy}
|
|
for _, a := range targets {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "EnqueueWithData", varargs...)
|
|
ret0, _ := ret[0].([]uuid.UUID)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// EnqueueWithData indicates an expected call of EnqueueWithData.
|
|
func (mr *MockEnqueuerMockRecorder) EnqueueWithData(ctx, userID, templateID, labels, data, createdBy any, targets ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, userID, templateID, labels, data, createdBy}, targets...)
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnqueueWithData", reflect.TypeOf((*MockEnqueuer)(nil).EnqueueWithData), varargs...)
|
|
}
|