diff --git a/internal/notification/repository/eventsourcing/handler/handler.go b/internal/notification/repository/eventsourcing/handler/handler.go index 639365a794..e30041fa16 100644 --- a/internal/notification/repository/eventsourcing/handler/handler.go +++ b/internal/notification/repository/eventsourcing/handler/handler.go @@ -61,7 +61,7 @@ func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es func (configs Configs) cycleDuration(viewModel string) time.Duration { c, ok := configs[viewModel] if !ok { - return 3 * time.Minute + return 1 * time.Minute } return c.MinimumCycleDuration.Duration } diff --git a/internal/notification/repository/eventsourcing/handler/notification.go b/internal/notification/repository/eventsourcing/handler/notification.go index 87f585e1a7..5bd850840c 100644 --- a/internal/notification/repository/eventsourcing/handler/notification.go +++ b/internal/notification/repository/eventsourcing/handler/notification.go @@ -436,25 +436,5 @@ func (n *Notification) getTranslatorWithOrgTexts(orgID, textType string) (*i18n. } func (n *Notification) getUserByID(userID string) (*model.NotifyUser, error) { - user, usrErr := n.view.NotifyUserByID(userID) - if usrErr != nil && !errors.IsNotFound(usrErr) { - return nil, usrErr - } - if user == nil { - user = &model.NotifyUser{} - } - events, err := n.getUserEvents(userID, user.Sequence) - if err != nil { - return user, usrErr - } - userCopy := *user - for _, event := range events { - if err := userCopy.AppendEvent(event); err != nil { - return user, nil - } - } - if userCopy.State == int32(model.UserStateDeleted) { - return nil, errors.ThrowNotFound(nil, "HANDLER-3n8fs", "Errors.User.NotFound") - } - return &userCopy, nil + return n.view.NotifyUserByID(userID) } diff --git a/internal/notification/repository/eventsourcing/handler/notify_user.go b/internal/notification/repository/eventsourcing/handler/notify_user.go index a1bf6829a6..8ed3ae84a0 100644 --- a/internal/notification/repository/eventsourcing/handler/notify_user.go +++ b/internal/notification/repository/eventsourcing/handler/notify_user.go @@ -196,12 +196,10 @@ func (u *NotifyUser) fillPreferredLoginNamesOnOrgUsers(event *es_models.Event) e if err != nil { return err } - policy := new(query2.OrgIAMPolicy) - if policy == nil { - policy, err = u.getDefaultOrgIAMPolicy(context.Background()) - if err != nil { - return err - } + + policy, err := u.getDefaultOrgIAMPolicy(context.Background()) + if err != nil { + return err } if !policy.UserLoginMustBeDomain { return nil @@ -225,12 +223,10 @@ func (u *NotifyUser) fillLoginNames(user *view_model.NotifyUser) (err error) { if err != nil { return err } - policy := new(query2.OrgIAMPolicy) - if policy == nil { - policy, err = u.getDefaultOrgIAMPolicy(context.Background()) - if err != nil { - return err - } + + policy, err := u.getDefaultOrgIAMPolicy(context.Background()) + if err != nil { + return err } user.SetLoginNames(policy, org.Domains) user.PreferredLoginName = user.GenerateLoginName(org.GetPrimaryDomain().Domain, policy.UserLoginMustBeDomain)