Skip to content

Commit

Permalink
Replace calendar confirmation with a button.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Oct 27, 2024
1 parent 239c9cc commit b0db7b9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion slack-sup/models/sup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,22 @@ def captain_user_name
def notify_gcal_html_link_changed!
return unless gcal_html_link && (gcal_html_link_changed? || saved_change_to_gcal_html_link?)

dm!(text: "I've added this S'Up to your Google Calendar: #{gcal_html_link}")
dm!(
{
text: "I've added this S'Up to your Google Calendar.",
attachments: [
{
text: '',
attachment_type: 'default',
actions: [{
type: 'button',
text: 'Google Calendar',
url: gcal_html_link
}]
}
]
}
)
end

def select_best_captain
Expand Down
17 changes: 16 additions & 1 deletion spec/api/endpoints/sups_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,22 @@
end

it 'updates a sup html link and DMs sup' do
expect_any_instance_of(Sup).to receive(:dm!).with(text: "I've added this S'Up to your Google Calendar: updated")
expect_any_instance_of(Sup).to receive(:dm!).with(
{
text: "I've added this S'Up to your Google Calendar.",
attachments: [
{
text: '',
attachment_type: 'default',
actions: [{
type: 'button',
text: 'Google Calendar',
url: 'updated'
}]
}
]
}
)
client.headers.update('X-Access-Token' => team.short_lived_token)
client.sup(id: existing_sup.id)._put(gcal_html_link: 'updated')
expect(existing_sup.reload.gcal_html_link).to eq 'updated'
Expand Down

0 comments on commit b0db7b9

Please sign in to comment.