mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-12 21:58:58 -04:00
fix: restructure call order
This commit is contained in:
1 parent
93d66a0f37
commit
bbee2b7433
1 file changed
+8
-8
@@ -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")
|
||||
|
||||
Reference in new issue
Block a user