Simplify MSG case handling in ChatService by directly comparing receiver UUID.

This commit is contained in:
akastijn 2026-08-01 21:52:29 +02:00
parent a9d788b319
commit ed942d5ec5

View File

@ -118,20 +118,7 @@ public class ChatService {
}
yield chatMessage.getChannel().equals(String.valueOf(partyId));
}
case MSG -> {
if (eventUser.uuid().equals(chatMessage.getUuid())) {
yield true;
}
if (chatMessage.getReceiver() != null) {
try {
UUID receiverUuid = UUID.fromString(chatMessage.getReceiver());
yield eventUser.uuid().equals(receiverUuid);
} catch (IllegalArgumentException e) {
yield false;
}
}
yield false;
}
case MSG -> eventUser.uuid().toString().equals(chatMessage.getReceiver());
case GAC -> eventUser.hasPermission(PermissionClaimDto.MOD);
case CUSTOM -> false;
};