Skip to content

Commit d0656f8

Browse files
committed
fix: 150자 초과시 최대 허용 범위까지 잘라서 보내도록 수정
1 parent ef7deb8 commit d0656f8

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/main/java/org/sopt/makers/global/constant/SlackConstant.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public final class SlackConstant {
4141
public static final String ERROR = "error";
4242
public static final String CODE = "code";
4343

44+
// 헤더 관련 상수
45+
public static final int MAX_HEADER_LENGTH = 150;
46+
public static final String EMOJI_PREFIX = "🚨 ";
47+
public static final String TRUNCATION_SUFFIX = "...";
48+
4449
// 성공 메시지
4550
public static final String SUCCESS_MESSAGE = "알림이 성공적으로 전송되었습니다";
4651

src/main/java/org/sopt/makers/service/SlackNotificationService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,18 @@ private SlackMessage buildSlackMessage(String team, String type, String stage,
106106
return SlackMessage.newInstance(blocks, color);
107107
}
108108

109-
/**
109+
/*
110110
* 헤더 블록 구성
111111
*/
112112
private Block buildHeaderBlock(String message) {
113-
return HeaderBlock.newInstance(message);
113+
String fullMessage = EMOJI_PREFIX + message;
114+
115+
if (fullMessage.length() > MAX_HEADER_LENGTH) {
116+
int maxLength = MAX_HEADER_LENGTH - EMOJI_PREFIX.length() - TRUNCATION_SUFFIX.length();
117+
fullMessage = EMOJI_PREFIX + message.substring(0, maxLength) + TRUNCATION_SUFFIX;
118+
}
119+
120+
return HeaderBlock.newInstance(fullMessage);
114121
}
115122

116123
/**

0 commit comments

Comments
 (0)