-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Support appending to message attachments instead of replacing #74
base: main
Are you sure you want to change the base?
Conversation
) | ||
} | ||
|
||
private suspend fun getSlackMessageById( |
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.
These functions are moved to SlackHttpClient.
@@ -126,81 +121,54 @@ class SlackClient( | |||
messageId: String? = null, | |||
previousAttachments: List<SlackMessage.Attachment>? = null, | |||
): SlackMessage { | |||
val attachments = mutableMapOf<JobType, SlackMessage.Attachment>() | |||
val attachments = if (appendAttachments) { |
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.
This is the primary change of the PR, adding support for appending attachments instead of replacing them, depending on the input property.
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.
For php release flow, we would like timestamps on the events, e.g. when build started, when deploy finished. To support that, I've added a flag called
append-status-updates
which will add new attachments with status updates incl timestamp to existing slack messages instead of replacing them with new status.I've added two tests; one of the replacing functionality and one of the appending functionality
To make the tests work, I had to inject a layer between the message builder and the http client in
SlackClient
, which I callSlackHttpClient
, which I then replace with a fake instance during testing, to assert on the messages and content that would be sent to slack.Disclaimer: This is my first Kotlin PR ever, so I accept a lot of feedback. :D