File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
src/main/kotlin/org/gitanimals/notification Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import org.gitanimals.core.redis.TraceableMessageListener
55import org.gitanimals.notification.app.event.NotApprovedQuizCreatedNotification
66import org.gitanimals.notification.domain.Notification
77import org.gitanimals.notification.domain.Notification.ActionRequest
8+ import org.gitanimals.notification.domain.Notification.ActionRequest.Style.DANGER
9+ import org.gitanimals.notification.domain.Notification.ActionRequest.Style.PRIMARY
810import org.slf4j.LoggerFactory
911import org.springframework.beans.factory.annotation.Qualifier
1012import org.springframework.beans.factory.annotation.Value
@@ -63,13 +65,13 @@ class NotApprovedQuizCreatedMessageListener(
6365 actions = listOf (
6466 ActionRequest (
6567 id = " approve_action" ,
66- style = " primray " ,
68+ style = PRIMARY ,
6769 name = " Approve" ,
6870 interaction = payloadWhenApprovedButtonClicked,
6971 ),
7072 ActionRequest (
7173 id = " delete_action" ,
72- style = " danger " ,
74+ style = DANGER ,
7375 name = " Deny" ,
7476 interaction = payloadWhenNotApprovedButtonClicked,
7577 )
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import org.gitanimals.core.redis.TraceableMessageListener
55import org.gitanimals.notification.app.event.NewQuizCreatedNotification
66import org.gitanimals.notification.domain.Notification
77import org.gitanimals.notification.domain.Notification.ActionRequest
8+ import org.gitanimals.notification.domain.Notification.ActionRequest.Style.DANGER
89import org.slf4j.LoggerFactory
910import org.springframework.beans.factory.annotation.Qualifier
1011import org.springframework.beans.factory.annotation.Value
@@ -45,7 +46,7 @@ class QuizCreatedMessageListener(
4546 ActionRequest (
4647 id = " delete_action" ,
4748 name = " Delete" ,
48- style = " danger " ,
49+ style = DANGER ,
4950 interaction = mapOf (
5051 " clicked" to " DELETE" ,
5152 " sourceKey" to " DELETE_QUIZ" ,
Original file line number Diff line number Diff line change @@ -16,7 +16,14 @@ interface Notification {
1616 data class ActionRequest (
1717 val id : String ,
1818 val name : String ,
19- val style : String ,
19+ val style : Style ,
2020 val interaction : Map <String , * >
21- )
21+ ) {
22+
23+ enum class Style {
24+ PRIMARY ,
25+ DANGER ,
26+ ;
27+ }
28+ }
2229}
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ sealed class SlackNotification(
4646 actions.map {
4747 ButtonElement .builder()
4848 .text(PlainTextObject .builder().text(it.name).emoji(true ).build())
49- .style(it.style)
49+ .style(it.style.name.lowercase() )
5050 .actionId(it.id)
5151 .value(objectMapper.writeValueAsString(it.interaction))
5252 .build()
You can’t perform that action at this time.
0 commit comments