-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add internal submission finished notifications
- Loading branch information
Showing
10 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
7 changes: 7 additions & 0 deletions
7
app/libs/notifiers/slack/renderers/internal_submission_finished.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Notifiers | ||
module Slack | ||
class Renderers::InternalSubmissionFinished < Renderers::Base | ||
TEMPLATE_FILE = "internal_submission_finished.json.erb".freeze | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
app/views/notifiers/slack/internal_submission_finished.json.erb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":sparkles: The internal build *<%= @release_version %> (<%= @build_number %>)* for commit <<%= @commit_url %>|<%= @commit_sha %>> has been sent to <%= @submission_channel %>." | ||
} | ||
} | ||
] | ||
} |
This file contains 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
25 changes: 25 additions & 0 deletions
25
db/data/20241114183647_add_internal_submission_notification_setting.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddInternalSubmissionNotificationSetting < ActiveRecord::Migration[7.2] | ||
def up | ||
ActiveRecord::Base.transaction do | ||
Train.all.where.not(notification_channel: nil).each do |train| | ||
next if train.notification_settings.empty? | ||
|
||
setting = train.notification_settings.find_by(kind: NotificationSetting.kinds[:internal_submission_finished]) | ||
next if setting.present? | ||
internal_release_finished_setting = train.notification_settings.find_by(kind: NotificationSetting.kinds[:internal_release_finished]) | ||
|
||
train.notification_settings.create!( | ||
kind: NotificationSetting.kinds[:internal_submission_finished], | ||
notification_channels: internal_release_finished_setting.notification_channels, | ||
active: internal_release_finished_setting.active | ||
) | ||
end | ||
end | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
DataMigrate::Data.define(version: 20241010215923) | ||
DataMigrate::Data.define(version: 20241114183647) |