Skip to content

Comments

[FEAT] 마스킹 기능을 이벤트로 분리#426

Merged
Jin409 merged 2 commits intomainfrom
feat/cheer-talk-send-again
Feb 9, 2026
Merged

[FEAT] 마스킹 기능을 이벤트로 분리#426
Jin409 merged 2 commits intomainfrom
feat/cheer-talk-send-again

Conversation

@Jin409
Copy link
Contributor

@Jin409 Jin409 commented Feb 9, 2026

이슈 배경

기존의 문제

  • 욕설이 포함되어 마스킹 된 응원톡이 DB 에만 반영되었어요.
  • 이로 인해 사용자들은 새로고침이 되기 전까지 욕설에 노출될 우려가 있어요.

해결 방식

  • 소켓으로 동일한 응원톡을 한번 더 전송해요.
  • 프론트 측에서 중복되는 응원톡을 핸들링 해요

확인해야 할 부분

  • 책임 분리의 관점에서 마스킹도 이벤트로 이뤄지도록 했어요.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Jin409, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 응원톡 마스킹 기능을 이벤트 기반 아키텍처로 재구성하여, 초기 응원톡 생성 및 전송 로직과 마스킹 로직을 분리합니다. 기존에는 마스킹이 동기적으로 처리되어 사용자가 비속어에 노출될 우려가 있었으나, 이제는 마스킹 이벤트를 발행하고 별도의 핸들러에서 비동기적으로 처리함으로써 이러한 문제를 해결하고 프론트엔드에서 중복 응원톡을 효율적으로 처리할 수 있도록 개선되었습니다.

Highlights

  • 마스킹 기능 이벤트 분리: 응원톡 마스킹 로직이 CheerTalkMaskingEvent를 발행하는 방식으로 분리되어, CheerTalkEventHandler에서 직접 마스킹 서비스를 호출하지 않도록 변경되었습니다.
  • 새로운 이벤트 핸들러 도입: CheerTalkMaskingEvent를 수신하고 마스킹 로직을 처리한 후, 마스킹된 응원톡을 WebSocket으로 전송하는 CheerTalkMaskingEventHandler가 새로 추가되었습니다.
  • 마스킹 서비스 반환 타입 변경: CheerTalkMaskingServicemaskingCheerTalk 메서드가 마스킹 여부와 마스킹된 내용을 포함하는 CheerTalkMaskedResponse 객체를 반환하도록 변경되었습니다.
  • 테스트 코드 변경: 기존 CheerTalkEventHandlerTest의 주석 처리된 테스트 케이스가 활성화되었으나, @Disabled 어노테이션이 추가되어 현재는 실행되지 않습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/main/java/com/sports/server/command/cheertalk/application/CheerTalkMaskingService.java
    • CheerTalkMaskedResponse를 임포트했습니다.
    • maskingCheerTalk 메서드의 반환 타입을 void에서 CheerTalkMaskedResponse로 변경했습니다.
    • 마스킹이 실제로 발생했는지 확인하고, 그에 따라 CheerTalk 내용을 업데이트하고 응답을 반환하는 로직을 추가했습니다.
  • src/main/java/com/sports/server/command/cheertalk/domain/CheerTalkMaskingEvent.java
    • 새로운 파일: CheerTalk 객체와 gameId를 포함하는 CheerTalkMaskingEvent 레코드를 정의했습니다.
  • src/main/java/com/sports/server/command/cheertalk/dto/CheerTalkMaskedResponse.java
    • 새로운 파일: 비속어 포함 여부(boolean containsBadWord)와 마스킹된 내용(String maskedContent)을 담는 CheerTalkMaskedResponse 레코드를 정의했습니다.
  • src/main/java/com/sports/server/query/presentation/CheerTalkEventHandler.java
    • CheerTalkMaskingService에 대한 직접적인 의존성을 제거했습니다.
    • 대신 ApplicationEventPublisher를 주입받도록 변경했습니다.
    • handle(CheerTalkCreateEvent event) 메서드에서 cheerTalkMaskingService.maskingCheerTalk를 직접 호출하는 대신 CheerTalkMaskingEvent를 발행하도록 수정했습니다.
  • src/main/java/com/sports/server/query/presentation/CheerTalkMaskingEventHandler.java
    • 새로운 파일: CheerTalkMaskingEvent를 수신하는 새로운 이벤트 핸들러를 추가했습니다.
    • SimpMessagingTemplate, PendingCheerTalkRepository, CheerTalkMaskingService를 주입받습니다.
    • cheerTalkMaskingService.maskingCheerTalk를 호출하고, 마스킹이 발생한 경우 마스킹된 응원톡을 WebSocket을 통해 전송합니다.
    • WebSocket 전송 실패 시 PendingCheerTalkRepository에 저장하는 오류 처리 로직을 포함합니다.
  • src/test/java/com/sports/server/query/acceptance/CheerTalkEventHandlerTest.java
    • @ActiveProfiles 어노테이션을 제거했습니다.
    • 주석 처리되어 있던 응원톡을_작성하면_소켓_응답을_받는다() 테스트 메서드를 활성화하고 @Disabled 어노테이션을 추가했습니다.
Activity
  • 응원톡 마스킹 처리를 이벤트 기반으로 전환하여 시스템의 결합도를 낮추고 비동기 처리를 가능하게 했습니다.
  • 기존 CheerTalkEventHandler의 역할을 분리하여, 생성 이벤트 처리와 마스킹 이벤트 처리를 각각의 핸들러가 담당하도록 했습니다.
  • 마스킹 서비스의 반환 값을 구체화하여 마스킹 여부를 명확히 알 수 있도록 개선했습니다.
  • 테스트 코드의 일부 변경은 향후 마스킹 로직의 통합 테스트를 위한 준비 단계로 보입니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 PR은 응원톡 마스킹 기능을 이벤트 기반으로 분리하여 비동기적으로 처리하도록 개선하는 좋은 시도입니다. 이를 통해 기존에 마스킹된 내용이 DB에만 반영되던 문제를 해결하고, 사용자 경험을 향상시킬 수 있을 것으로 기대됩니다.

다만, 리뷰 과정에서 몇 가지 심각한 버그와 개선점을 발견했습니다.

  • CheerTalkMaskingEventHandler에서 maskingCheerTalk 서비스 호출 시 cheerTalkId 대신 gameId를 전달하는 버그가 있습니다.
  • 마스킹 처리 후 웹소켓으로 응답을 보낼 때, 마스킹이 적용되지 않은 이전 데이터를 전송하는 문제가 있습니다.
  • 트랜잭션 내에서 외부 API를 호출하는 성능 저하 유발 코드가 여전히 남아있습니다.

위 사항들은 시스템의 오작동 및 성능 저하를 일으킬 수 있으므로, 머지 전에 반드시 수정이 필요합니다. 자세한 내용은 각 파일의 리뷰 코멘트를 참고해주세요.

@Jin409 Jin409 merged commit ccc04a3 into main Feb 9, 2026
1 check passed
@Jin409 Jin409 deleted the feat/cheer-talk-send-again branch February 9, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant