From bbee2b7433e35a17b85a7c0c25a70e2e0a35edbe Mon Sep 17 00:00:00 2001 From: Florian Schade Date: Tue, 18 Aug 2026 09:35:47 +0200 Subject: [PATCH] fix: restructure call order --- services/graph/pkg/service/v0/teamwork.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/services/graph/pkg/service/v0/teamwork.go b/services/graph/pkg/service/v0/teamwork.go index e1e1216914..2d979891dd 100644 --- a/services/graph/pkg/service/v0/teamwork.go +++ b/services/graph/pkg/service/v0/teamwork.go @@ -56,14 +56,6 @@ func (g Graph) SendActivityNotification(w http.ResponseWriter, r *http.Request) return } - if _, err := g.permissionsService.GetPermissionByID(ctx, &settingssvc.GetPermissionByIDRequest{ - PermissionId: settingsServiceExt.CollaborationPublishNotificationPermission(0).Id, - }); err != nil { - g.logger.Debug().Err(err).Msg("user is not allowed to publish activity notifications") - errorcode.AccessDenied.Render(w, r, http.StatusForbidden, "not allowed to publish activity notifications") - return - } - userID, err := url.PathUnescape(chi.URLParam(r, "userID")) if err != nil || userID == "" { errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "invalid user id") @@ -96,6 +88,14 @@ func (g Graph) SendActivityNotification(w http.ResponseWriter, r *http.Request) return } + if _, err := g.permissionsService.GetPermissionByID(ctx, &settingssvc.GetPermissionByIDRequest{ + PermissionId: settingsServiceExt.CollaborationPublishNotificationPermission(0).Id, + }); err != nil { + g.logger.Debug().Err(err).Msg("user is not allowed to publish activity notifications") + errorcode.AccessDenied.Render(w, r, http.StatusForbidden, "not allowed to publish activity notifications") + return + } + gatewayClient, err := g.gatewaySelector.Next() if err != nil { g.logger.Error().Err(err).Msg("could not select next gateway client")