@@ -126,9 +126,6 @@ public Mono<Void> publishApplicationCommonEvent(ApplicationView originalApplicat
126126 public Mono <Void > publishApplicationCommonEvent (ApplicationView originalApplicationView , ApplicationView applicationView , EventType eventType ) {
127127 return sessionUserService .isAnonymousUser ()
128128 .flatMap (anonymous -> {
129- if (anonymous ) {
130- return Mono .empty ();
131- }
132129 return sessionUserService .getVisitorOrgMemberCache ()
133130 .zipWith (Mono .defer (() -> {
134131 String folderId = applicationView .getApplicationInfoView ().getFolderId ();
@@ -204,50 +201,45 @@ public Mono<Void> publishApplicationCommonEvent(ApplicationView originalApplicat
204201 });
205202 });
206203 }
207-
204+
208205
209206 public Mono <Void > publishApplicationPermissionEvent (String applicationId , Set <String > userIds , Set <String > groupIds , String permissionId , String role ) {
210207 return sessionUserService .isAnonymousUser ()
211- .flatMap (anonymous -> {
212- if (anonymous ) {
213- return Mono .empty ();
214- }
215- return sessionUserService .getVisitorOrgMemberCache ()
216- .zipWith (sessionUserService .getVisitorToken ())
217- .zipWith (applicationService .findById (applicationId )
218- .zipWhen (application -> application .getCategory (applicationRecordServiceImpl ))
219- .zipWhen (application -> application .getT1 ().getDescription (applicationRecordServiceImpl )))
220- .flatMap (tuple -> {
221- OrgMember orgMember = tuple .getT1 ().getT1 ();
222- String token = tuple .getT1 ().getT2 ();
223- String category = tuple .getT2 ().getT1 ().getT2 ();
224- String description = tuple .getT2 ().getT2 ();
225- Application application = tuple .getT2 ().getT1 ().getT1 ();
226-
227- ApplicationCommonEvent event = ApplicationCommonEvent .builder ()
228- .orgId (orgMember .getOrgId ())
229- .userId (orgMember .getUserId ())
230- .applicationId (application .getId ())
231- .applicationGid (application .getGid ())
232- .applicationName (application .getName ())
233- .applicationCategory (category )
234- .applicationDescription (description )
235- .type (EventType .APPLICATION_PERMISSION_CHANGE )
236- .permissionId (permissionId )
237- .role (role )
238- .userIds (userIds )
239- .groupIds (groupIds )
240- .isAnonymous (anonymous )
241- .sessionHash (Hashing .sha512 ().hashString (token , StandardCharsets .UTF_8 ).toString ())
242- .build ();
243-
244- return Mono .deferContextual (contextView -> {
245- event .populateDetails (contextView );
246- applicationEventPublisher .publishEvent (event );
247- return Mono .empty ();
248- }).then (); // **Fix: Ensures Mono<Void> is returned**
249- });
250- })
208+ .flatMap (anonymous -> sessionUserService .getVisitorOrgMemberCache ()
209+ .zipWith (sessionUserService .getVisitorToken ())
210+ .zipWith (applicationService .findById (applicationId )
211+ .zipWhen (application -> application .getCategory (applicationRecordServiceImpl ))
212+ .zipWhen (application -> application .getT1 ().getDescription (applicationRecordServiceImpl )))
213+ .flatMap (tuple -> {
214+ OrgMember orgMember = tuple .getT1 ().getT1 ();
215+ String token = tuple .getT1 ().getT2 ();
216+ String category = tuple .getT2 ().getT1 ().getT2 ();
217+ String description = tuple .getT2 ().getT2 ();
218+ Application application = tuple .getT2 ().getT1 ().getT1 ();
219+
220+ ApplicationCommonEvent event = ApplicationCommonEvent .builder ()
221+ .orgId (orgMember .getOrgId ())
222+ .userId (orgMember .getUserId ())
223+ .applicationId (application .getId ())
224+ .applicationGid (application .getGid ())
225+ .applicationName (application .getName ())
226+ .applicationCategory (category )
227+ .applicationDescription (description )
228+ .type (EventType .APPLICATION_PERMISSION_CHANGE )
229+ .permissionId (permissionId )
230+ .role (role )
231+ .userIds (userIds )
232+ .groupIds (groupIds )
233+ .isAnonymous (anonymous )
234+ .sessionHash (Hashing .sha512 ().hashString (token , StandardCharsets .UTF_8 ).toString ())
235+ .build ();
236+
237+ return Mono .deferContextual (contextView -> {
238+ event .populateDetails (contextView );
239+ applicationEventPublisher .publishEvent (event );
240+ return Mono .empty ();
241+ }).then (); // **Fix: Ensures Mono<Void> is returned**
242+ }))
251243 .onErrorResume (throwable -> {
252244 log .error ("publishApplicationPermissionEvent error. {}, {}, {}" , applicationId , permissionId , role , throwable );
253245 return Mono .empty ();
0 commit comments