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

채팅 알림 버그픽스 #687

Open
wants to merge 12 commits into
base: develop-backend
Choose a base branch
from
Open

채팅 알림 버그픽스 #687

wants to merge 12 commits into from

Conversation

pricelees
Copy link
Contributor

@pricelees pricelees commented Oct 18, 2024

PR의 목적이 무엇인가요?

QA 과정에서 발생한 채팅 알림 관련 문제를 해결했습니다.

이슈 ID는 무엇인가요?

설명

1. 모임 정보를 수정 시 알림 문제

모임 정보 수정 시, 이름을 변경한 경우 변경된 이름으로 알림을 보내서 사용자에게 혼동을 줄 여지가 있다고 판단했습니다.
(예시) 원래 모임 이름이 "모임" 이고 변경된 모임 이름이 "모임12" 라면, 사용자에겐 "모임12" 정보가 바뀜 ~ 으로 알림이 나갔는데, 사용자 입장에서는 "모임12" 라는 모임에 들어간 적은 없으니 헷갈릴 수 있음..

따라서 이 경우 기존 모임 이름을 받아 기존 모임의 이름을 넣도록 수정했습니다.

2. 채팅 알림 메시지 형식 수정

이전 수정에서, 채팅 알림의 경우 아래와 같은 형식으로 알림이 전송됐었습니다.

기존

일반 채팅 전송시

[모임 / 베팅 이름]
모우다에서 보냄
[보낸사람]: [내용]

장소 / 시간 확정시

[모임 / 베팅 이름]
모우다에서 보냄
장소가 [장소]로 확정되었어요!

푸시 알림만 보면 어떤 모임에서 누가 메시지를 보냈는지 확실하게 나타나긴 하지만, 알림 센터에서 조회 시 "장소가 [장소]로 확정되었어요!" 인 메시지만 나타나 사용자가 어떤 모임인지 식별하기 힘들겠다는 생각으로 아래와 같이 조금 더 세분화하는 방식으로 수정했습니다.

수정

일반 채팅 전송시

[모임 / 베팅 이름]
모우다에서 보냄
[보낸사람]: [내용]

장소 / 시간 확정시

[다락방 이름]
모우다에서 보냄
'[모임이름]' 시간이 '[시간 -> ~월 ~일 ~시 ~분]'으로 확정되었어요!

3. 채팅 알림 구현 방법 수정

새로 추가된 Author와 ChatType을 활용하는 방식으로 수정했습니다. 처음에 ChatType을 사용할 땐 NotificationType을 더 이상 사용하지 않을 것으로 기대했으나, 알림 쪽 처리에서의 문제로 완전히 격리시킬 수는 없었습니다.

4. 베팅에서의 채팅은 알림이 안오는 문제 해결

일반 채팅방에서의 알림은 잘 오는데, 베팅에서는 알림이 오지 않고 에러도 발생하지 않아 디버깅할 수도 없었는데요, 어찌저찌하여 일부 코드를 수정했고 이제 정상 작동이 될 것 같습니다 ~

질문 혹은 공유 사항 (Optional)

@pricelees pricelees requested review from ay-eonii, ksk0605, hoyeonyy and Mingyum-Kim and removed request for ay-eonii October 18, 2024 09:20
Copy link
Contributor

@ay-eonii ay-eonii left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 빠른 작업👍

코멘트 확인해주세용~~~

Darakbang darakbang = darakbangRepository.findById(moim.getDarakbangId())
.orElseThrow(IllegalArgumentException::new);
.orElseThrow(() -> new DarakbangException(HttpStatus.NOT_FOUND, DarakbangErrorMessage.DARAKBANG_NOT_FOUND));
Copy link
Contributor

Choose a reason for hiding this comment

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

package에 해당하는 예외를 던져주기로 했던 것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

package에 해당하는 예외를 던져주기로 했던 것 같아요

해당 이유로 알림 타입에 대한 예외는 모임 에러를 사용했는데, 여기서는 좀 애매한 감이 있어서 다락방 예외를 사용했어요 ㅋㅋ 말씀주신대로 모임예외로 수정하고, 예외 메시지를 "모임에 해당되는 다락방을 찾을 수 없음" 으로 수정할게요 ~

MoimNotificationMessage.create(moim.getTitle(), notificationType),
getMoimUrl(darakbang.getId(), moim.getId()),
message,
getMoimUrl(darakbang.getId(), darakbang.getId()),
Copy link
Contributor

Choose a reason for hiding this comment

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

두개 다 다락방 아이디 맞나여??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

두개 다 다락방 아이디 맞나여??

아뇨 ㅋㅋ 감사용 ㅋㅋ

Copy link
Contributor Author

@pricelees pricelees left a comment

Choose a reason for hiding this comment

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

👍

Darakbang darakbang = darakbangRepository.findById(moim.getDarakbangId())
.orElseThrow(IllegalArgumentException::new);
.orElseThrow(() -> new DarakbangException(HttpStatus.NOT_FOUND, DarakbangErrorMessage.DARAKBANG_NOT_FOUND));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

package에 해당하는 예외를 던져주기로 했던 것 같아요

해당 이유로 알림 타입에 대한 예외는 모임 에러를 사용했는데, 여기서는 좀 애매한 감이 있어서 다락방 예외를 사용했어요 ㅋㅋ 말씀주신대로 모임예외로 수정하고, 예외 메시지를 "모임에 해당되는 다락방을 찾을 수 없음" 으로 수정할게요 ~

MoimNotificationMessage.create(moim.getTitle(), notificationType),
getMoimUrl(darakbang.getId(), moim.getId()),
message,
getMoimUrl(darakbang.getId(), darakbang.getId()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

두개 다 다락방 아이디 맞나여??

아뇨 ㅋㅋ 감사용 ㅋㅋ

@ay-eonii ay-eonii self-requested a review October 20, 2024 06:02
Copy link
Contributor

@ay-eonii ay-eonii left a comment

Choose a reason for hiding this comment

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

굿굿~👍

Copy link
Contributor

@ksk0605 ksk0605 left a comment

Choose a reason for hiding this comment

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

고생했어요 상돌!
간단한 변경사항만 수정 부탁드려요 😀

Comment on lines 15 to 17
public Author(long id, long memberId, String nickname, String profile) {
this.id = id;
this.memberId = memberId;
Copy link
Contributor

Choose a reason for hiding this comment

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

다락방멤버 id 인지 그냥 memberid인지 구분할 수 있으면 좋겠네요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

다락방멤버 id 인지 그냥 memberid인지 구분할 수 있으면 좋겠네요!

수정했어요 ~

Comment on lines 6 to 19
public class ChatDateTimeFormatter {

// 2024-10-21 17:08 형식의 데이터를 10월 21일 17시 08분으로 변경
public static String formatDateTime(String dateTime) {
String[] splitDateTime = dateTime.split(" ");
LocalDate date = LocalDate.parse(splitDateTime[0]);
LocalTime time = LocalTime.parse(splitDateTime[1]);

return date.getMonthValue() + "월 "
+ date.getDayOfMonth() + "일 "
+ time.getHour() + "시 "
+ time.getMinute() + "분";
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

생성할 필요가 없는 클래스의 생성자는 private으로 닫아주세요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

생성할 필요가 없는 클래스의 생성자는 private으로 닫아주세요!

넵 ~ 이왕 하는김에 조금 더 꼼꼼하게 처리해놨습니다 !

return getNotificationRecipients(darakbangMemberStream, sender);
}

// todo: 구버전 채팅 기능 삭제시 같이 지워주세요.
Copy link
Contributor

Choose a reason for hiding this comment

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

다음 버전에서 지우도록하죠!

Copy link
Contributor Author

@pricelees pricelees left a comment

Choose a reason for hiding this comment

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

하는김에 조금씩 더 다듬었어요 ~ㅎㅎ 확인 부탁요!

Comment on lines 6 to 19
public class ChatDateTimeFormatter {

// 2024-10-21 17:08 형식의 데이터를 10월 21일 17시 08분으로 변경
public static String formatDateTime(String dateTime) {
String[] splitDateTime = dateTime.split(" ");
LocalDate date = LocalDate.parse(splitDateTime[0]);
LocalTime time = LocalTime.parse(splitDateTime[1]);

return date.getMonthValue() + "월 "
+ date.getDayOfMonth() + "일 "
+ time.getHour() + "시 "
+ time.getMinute() + "분";
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

생성할 필요가 없는 클래스의 생성자는 private으로 닫아주세요!

넵 ~ 이왕 하는김에 조금 더 꼼꼼하게 처리해놨습니다 !

Comment on lines 15 to 17
public Author(long id, long memberId, String nickname, String profile) {
this.id = id;
this.memberId = memberId;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

다락방멤버 id 인지 그냥 memberid인지 구분할 수 있으면 좋겠네요!

수정했어요 ~

Copy link
Contributor

@ksk0605 ksk0605 left a comment

Choose a reason for hiding this comment

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

수정 사항 확인했습니다! 고생했어요~

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.

3 participants