feat: add im home and message action flows
This commit is contained in:
@@ -210,6 +210,14 @@ type testSecurityStore struct {
|
||||
err error
|
||||
bumped bool
|
||||
bumpedUser types.Uid
|
||||
|
||||
realName *types.RealNameVerification
|
||||
actionToken *types.ActionToken
|
||||
independentPassword *types.IndependentPassword
|
||||
attempts int
|
||||
lockedUntil *time.Time
|
||||
notifications []types.SystemNotification
|
||||
readNotificationID string
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) GetAuthVersion(types.TenantID, types.Uid) (int, error) {
|
||||
@@ -228,3 +236,83 @@ func (s *testSecurityStore) BumpAuthVersion(_ types.TenantID, uid types.Uid, _ t
|
||||
s.version++
|
||||
return s.version, s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) GetRealName(types.TenantID, types.Uid) (*types.RealNameVerification, error) {
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
if s.realName == nil {
|
||||
return nil, types.ErrNotFound
|
||||
}
|
||||
return s.realName, nil
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) CreateRealNameSubmission(_ types.TenantID, rv *types.RealNameVerification) error {
|
||||
s.realName = rv
|
||||
return s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) CreateActionToken(_ types.TenantID, token *types.ActionToken) error {
|
||||
s.actionToken = token
|
||||
return s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) ConsumeActionToken(_ types.TenantID, _ types.Uid, _ string, action string, target string, _ time.Time) (*types.ActionToken, error) {
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
if s.actionToken == nil {
|
||||
return &types.ActionToken{Action: action, Target: target}, nil
|
||||
}
|
||||
return s.actionToken, nil
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) GetIndependentPassword(types.TenantID, types.Uid, string) (*types.IndependentPassword, error) {
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
if s.independentPassword == nil {
|
||||
return nil, types.ErrNotFound
|
||||
}
|
||||
return s.independentPassword, nil
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) UpsertIndependentPassword(_ types.TenantID, pass *types.IndependentPassword) error {
|
||||
s.independentPassword = pass
|
||||
return s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) UpdateIndependentPasswordAttempts(_ types.TenantID, _ types.Uid, _ string, attempts int, lockedUntil *time.Time, _ time.Time) error {
|
||||
s.attempts = attempts
|
||||
s.lockedUntil = lockedUntil
|
||||
if s.independentPassword != nil {
|
||||
s.independentPassword.FailedAttempts = attempts
|
||||
s.independentPassword.LockedUntil = lockedUntil
|
||||
}
|
||||
return s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) CreateSystemNotification(_ types.TenantID, notification *types.SystemNotification) error {
|
||||
if notification != nil {
|
||||
s.notifications = append(s.notifications, *notification)
|
||||
}
|
||||
return s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) ListSystemNotifications(types.TenantID, types.Uid, string, int) ([]types.SystemNotification, string, error) {
|
||||
return s.notifications, "", s.err
|
||||
}
|
||||
|
||||
func (s *testSecurityStore) MarkSystemNotificationRead(_ types.TenantID, _ types.Uid, eventID string, readAt time.Time) error {
|
||||
s.readNotificationID = eventID
|
||||
for i := range s.notifications {
|
||||
if s.notifications[i].EventID == eventID {
|
||||
s.notifications[i].ReadAt = &readAt
|
||||
return s.err
|
||||
}
|
||||
}
|
||||
if s.err != nil {
|
||||
return s.err
|
||||
}
|
||||
return types.ErrNotFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user