Skip to content

Commit d69bdc6

Browse files
authored
release: 1.2.2 (#132)
2 parents 9fc0b08 + 80167bc commit d69bdc6

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/main/kotlin/org/gitanimals/notification/app/NotApprovedQuizCreatedMessageListener.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import org.gitanimals.core.redis.TraceableMessageListener
55
import org.gitanimals.notification.app.event.NotApprovedQuizCreatedNotification
66
import org.gitanimals.notification.domain.Notification
77
import 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
810
import org.slf4j.LoggerFactory
911
import org.springframework.beans.factory.annotation.Qualifier
1012
import 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
)

src/main/kotlin/org/gitanimals/notification/app/QuizCreatedMessageListener.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.gitanimals.core.redis.TraceableMessageListener
55
import org.gitanimals.notification.app.event.NewQuizCreatedNotification
66
import org.gitanimals.notification.domain.Notification
77
import org.gitanimals.notification.domain.Notification.ActionRequest
8+
import org.gitanimals.notification.domain.Notification.ActionRequest.Style.DANGER
89
import org.slf4j.LoggerFactory
910
import org.springframework.beans.factory.annotation.Qualifier
1011
import 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",

src/main/kotlin/org/gitanimals/notification/domain/Notification.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

src/main/kotlin/org/gitanimals/notification/infra/SlackNotifiactions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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()

0 commit comments

Comments
 (0)