changed jdk on 25 springBoot on 3.5.6 and fix code
This commit is contained in:
@@ -115,6 +115,18 @@ public class ChatService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Проверка для STOMP-интерцептора: пользователь состоит в чате или нет.
|
||||
* Не бросает исключений — вызывается на этапе авторизации подписки.
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public boolean isParticipant(Long chatId, Long userId) {
|
||||
if (chatId == null || userId == null) {
|
||||
return false;
|
||||
}
|
||||
return chatRepository.isParticipantOfChat(chatId, userId);
|
||||
}
|
||||
|
||||
private Chat getChatOrThrow(Long chatId) {
|
||||
return chatRepository.findById(chatId).orElseThrow(() -> new IllegalArgumentException("Чат не найден"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user