Skip to content

Commit

Permalink
Fix the relationship group won't be updated if `turms.service.notific…
Browse files Browse the repository at this point in the history
…ation.one-sided-relationship-group-updated.notify-relationship-group-members` is true #1586
  • Loading branch information
JamesChenX committed Dec 4, 2024
1 parent ff69c24 commit 1fc6d2e
Showing 1 changed file with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,23 +573,30 @@ public ClientRequestHandler handleUpdateRelationshipGroupRequest() {
Mono<UpdateResult> updateRelationshipGroup = userRelationshipGroupService
.updateRelationshipGroupName(ownerId, groupIndex, request.getNewName());
if (notifyRelationshipGroupMembersOfOneSidedRelationshipGroupUpdated) {
Recyclable<Set<Long>> recyclableSet = SetRecycler.obtain();
return userRelationshipGroupService
.queryRelationshipGroupMemberIds(ownerId, groupIndex)
.collect(Collectors.toCollection(recyclableSet::getValue))
.map(memberIds -> memberIds.isEmpty()
? RequestHandlerResult.of(
notifyRequesterOtherOnlineSessionsOfOneSidedRelationshipGroupUpdated,
clientRequest.turmsRequest())
: RequestHandlerResult.of(
notifyRequesterOtherOnlineSessionsOfOneSidedRelationshipGroupUpdated,
CollectionUtil.newSet(memberIds),
clientRequest.turmsRequest()))
.doFinally(signalType -> recyclableSet.recycle());
return updateRelationshipGroup.flatMap(result -> {
if (result.getModifiedCount() == 0) {
return Mono.just(RequestHandlerResult.OK);
}
Recyclable<Set<Long>> recyclableSet = SetRecycler.obtain();
return userRelationshipGroupService
.queryRelationshipGroupMemberIds(ownerId, groupIndex)
.collect(Collectors.toCollection(recyclableSet::getValue))
.map(memberIds -> memberIds.isEmpty()
? RequestHandlerResult.of(
notifyRequesterOtherOnlineSessionsOfOneSidedRelationshipGroupUpdated,
clientRequest.turmsRequest())
: RequestHandlerResult.of(
notifyRequesterOtherOnlineSessionsOfOneSidedRelationshipGroupUpdated,
CollectionUtil.newSet(memberIds),
clientRequest.turmsRequest()))
.doFinally(signalType -> recyclableSet.recycle());
});
}
return updateRelationshipGroup.thenReturn(RequestHandlerResult.of(
notifyRequesterOtherOnlineSessionsOfOneSidedRelationshipGroupUpdated,
clientRequest.turmsRequest()));
return updateRelationshipGroup.map(result -> result.getModifiedCount() == 0
? RequestHandlerResult.OK
: RequestHandlerResult.of(
notifyRequesterOtherOnlineSessionsOfOneSidedRelationshipGroupUpdated,
clientRequest.turmsRequest()));
};
}

Expand Down

0 comments on commit 1fc6d2e

Please sign in to comment.