Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore: ✨ Push Notifications for Users Not in Chat Room or Chat Room List View #204

Merged
merged 18 commits into from
Nov 20, 2024

Conversation

psychology50
Copy link
Member

@psychology50 psychology50 commented Nov 19, 2024

작업 이유

  • When someone in the chat room send message, Members who not in chat room or chat room list view can receive messages by push notification

작업 사항

flowchart TB
    A[채팅 메시지 발송] --> B{전송자 확인}
    B -->|전송자| C[알림 대상 제외]
    B -->|수신자| D{세션 상태 확인}
    
    D -->|채팅방 리스트 뷰| E[알림 대상 제외]
    D -->|채팅방 뷰| F[알림 대상 제외]
    D -->|기타 상태| G{채팅 알림 설정}
    
    G -->|비활성화| H[알림 대상 제외]
    G -->|활성화| I{채팅방 알림 설정}
    
    I -->|비활성화| J[알림 대상 제외]
    I -->|활성화| K[디바이스 토큰 수집]
    
    K --> L[푸시 알림 전송]
Loading
  • Encapsulated all domain business logic within domain service.
  • Implemented following domain rules:
    • Sender is always excluded from notification targets
    • Sessions viewing chat room list are excluded
    • If any session of a user is viewing the target chat room, all sessions of that user are excluded
    • Users with chat notifications disabled are excluded
    • Users with specific chat room notifications disabled are excluded

리뷰어가 중점적으로 확인해야 하는 부분

  1. Domain Service Design

    • Does it adhere to the SRP principle?
    • Is the business logic well encapsulated?
    • Is the filtering logic modularized effectively?
  2. Appropriateness of Filtering Logic For Push Notification Target

    • If any session of a user is viewing the target chat room, all sessions of that user are excluded
    • Sessions viewing the chat room list are excluded
    • The logic determines the behavior based on the user's notification settings.
  3. Test Coverage & Scenarios

    • Are all of domain rules evaluated by tests?
    • Are all of edge cases considered?
    • Is the Test Builder Pattern appropriate for representing BDD?
  4. Error Handling

    • Are exceptions handled when the sender is not found?
    • Is optional processing appropriate?
    • Is null safety ensured?

발견한 이슈

  1. Performance Concerns
    • When looking up both users and chat members, It causes N+1 queries.
    • This can be optimized by caching.
stateDiagram-v2
    [*] --> NotificationSetting: givenSender/Recipient
    
    NotificationSetting --> Configuration: withNotifyEnabled/Disabled
    
    state Configuration {
        [*] --> DeviceSetup
        DeviceSetup --> StatusSetup: withDeviceTokens
        StatusSetup --> ChatRoomSetup: withStatus
        ChatRoomSetup --> [*]: inChatRoom
    }
    
    Configuration --> TestFlow: and()
    TestFlow --> [*]: whenMocking
Loading
  1. Test Maintenance

    • The Test Builder Pattern simplifies writing test code; however, it increases maintenance complexity.
  2. Future Considerations

    • Cache strategy
    • Performance evaluation for large chat room
    • Retry rules when failed push notifications

@psychology50 psychology50 added the enhancement New feature or request label Nov 19, 2024
@psychology50 psychology50 self-assigned this Nov 19, 2024
@psychology50 psychology50 merged commit d40b450 into dev Nov 20, 2024
1 check passed
@psychology50 psychology50 deleted the feat/PW-616-chat-message-realy branch November 20, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant