Rework people list and trust center access list + edit dialog

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-05 14:32:28 +04:00
parent 4279f92d96
commit 0d1bcd21aa
17 changed files with 707 additions and 578 deletions

View File

@@ -288,15 +288,12 @@ func (s TrustCenterAccessService) Update(
ctx context.Context,
req *UpdateTrustCenterAccessRequest,
) (*coredata.TrustCenterAccess, error) {
if err := req.Validate(); err != nil {
return nil, err
}
now := time.Now()
var (
access *coredata.TrustCenterAccess
profile *coredata.MembershipProfile
trustCenterAcessActivated bool
shouldUpdateSlackMessage bool
)
@@ -310,24 +307,6 @@ func (s TrustCenterAccessService) Update(
return fmt.Errorf("cannot load trust center access: %w", err)
}
access.UpdatedAt = now
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
return fmt.Errorf("cannot update trust center access: %w", err)
}
// FIXME: need to change UX
profile = &coredata.MembershipProfile{}
if err := profile.LoadByIdentityIDAndOrganizationID(ctx, tx, s.svc.scope, access.OrganizationID, access.IdentityID); err != nil {
if !errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot load profile: %w", err)
}
if err := profile.Insert(ctx, tx); err != nil {
return fmt.Errorf("cannot insert profile: %w", err)
}
}
var tcdas coredata.TrustCenterDocumentAccesses
if len(req.DocumentAccesses) > 0 {
@@ -392,7 +371,7 @@ func (s TrustCenterAccessService) Update(
}
if shouldUpdateSlackMessage {
if err := s.svc.SlackMessages.QueueSlackNotification(ctx, profile.IdentityID, access.TrustCenterID); err != nil {
if err := s.svc.SlackMessages.QueueSlackNotification(ctx, access.IdentityID, access.TrustCenterID); err != nil {
if !errors.Is(err, slack.ErrNoSlackConnector) {
return nil, fmt.Errorf("cannot queue slack notification: %w", err)
}