-
Notifications
You must be signed in to change notification settings - Fork 1
[Fix] 솝트로그 아이콘 정렬 추가 (#513) #514
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the ordering of Sopt log icons by introducing a configurable S3 base URL and sorting the icons using a priority list with regex-based extraction of the icon name.
- Introduces a new configuration property for the S3 base URL.
- Implements icon sorting based on a defined priority list using regex for extraction.
| List<String> icons = authFacade.getIcons(isActive ? IconType.ACTIVE : IconType.INACTIVE); | ||
| List<String> iconPriority = List.of("sop-level", "poke", "soptamp", "duration"); | ||
| icons.sort(Comparator.comparingInt(s -> { | ||
| String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", ""); |
Copilot
AI
Mar 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex may not correctly match the literal ".png" extension since the period is unescaped. Consider using "\.png$" to ensure the period is treated as a literal dot.
| String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", ""); | |
| String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|\\.png$", ""); |
| List<String> iconPriority = List.of("sop-level", "poke", "soptamp", "duration"); | ||
| icons.sort(Comparator.comparingInt(s -> { | ||
| String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", ""); | ||
| return iconPriority.indexOf(iconName); |
Copilot
AI
Mar 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If iconPriority.indexOf(iconName) returns -1 for icons not listed in iconPriority, it could lead to unintended sorting behavior. Consider handling cases where iconName is not found explicitly.
| return iconPriority.indexOf(iconName); | |
| int index = iconPriority.indexOf(iconName); | |
| return index == -1 ? Integer.MAX_VALUE : index; |
Related issue 🛠
Work Description ✏️
솝트로그 아이콘을 정렬했습니다.
정렬 기준이 바뀔 경우를 대비해 정규 표현식을 사용해 정렬했습니다.
sopt-backend/src/main/java/org/sopt/app/presentation/user/UserController.java
Lines 121 to 125 in 58a7652
Trouble Shooting ⚽️
Related ScreenShot 📷
Uncompleted Tasks 😅
To Reviewers 📢