Fix the mattermost created at timestamp#150
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the “Created” timestamp formatting for the Mattermost v3 channel integration, while refactoring Slack v3 to route timestamp rendering through an overridable helper.
Changes:
- Update Mattermost v3 “Created” field output to an ISO8601 timestamp.
- Extract Slack v3 “Created” field formatting into
_alert_created_at_timestamp_formatted. - Update the Mattermost v3 test expectations to match the new timestamp format.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| test/models/pager_tree/integrations/channel/mattermost/v3_test.rb | Updates expected “Created” field value to ISO8601 for Mattermost payloads. |
| app/models/pager_tree/integrations/channel/slack/v3.rb | Adds a helper for Slack date formatting and uses it in the outgoing payload blocks. |
| app/models/pager_tree/integrations/channel/mattermost/v3.rb | Overrides the Slack helper to emit an ISO8601 timestamp for Mattermost. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+71
to
76
| def _alert_created_at_timestamp_formatted | ||
| "<!date^#{_alert.created_at.utc.to_i}^{date_num} {time_secs}|#{_alert.created_at.utc.to_i}>" | ||
| end | ||
|
|
||
| private | ||
|
|
| # we can just piggy back the Channel::Slack::V3 since Mattermost is a clone of Slack | ||
| # both integrations have the same exact functionality | ||
|
|
||
| def _alert_created_at_timestamp_formatted |
| { | ||
| title: "Created", | ||
| value: "<!date^#{@alert.created_at.utc.to_i}^{date_num} {time_secs}|#{@alert.created_at.utc.to_i}>", | ||
| value: @alert.created_at.utc.iso8601.to_s, |
| # both integrations have the same exact functionality | ||
|
|
||
| def _alert_created_at_timestamp_formatted | ||
| _alert.created_at.utc.iso8601.to_s |
| end | ||
|
|
||
| def _alert_created_at_timestamp_formatted | ||
| "<!date^#{_alert.created_at.utc.to_i}^{date_num} {time_secs}|#{_alert.created_at.utc.to_i}>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.