Skip to content

Commit

Permalink
Unfurl into blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Nov 24, 2024
1 parent aa55d40 commit 930c645
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-11-24 16:41:14 UTC using RuboCop version 1.68.0.
# on 2024-11-24 16:50:24 UTC using RuboCop version 1.68.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down
8 changes: 5 additions & 3 deletions slack-strava/api/endpoints/requests/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ def unfurl!
next unless activity

logger.info "UNFURL: #{link.url}, #{activity}"

unfurls = { link.url => { blocks: activity.to_slack_blocks } }
logger.debug(unfurls)

team.activated_user_slack_client.chat_unfurl(
channel: event.channel,
ts: event.message_ts,
unfurls: {
link.url => activity.to_slack_attachment
}.to_json
unfurls: unfurls.to_json
)

activity.update_attributes!(bragged_at: Time.now.utc)
Expand Down
2 changes: 1 addition & 1 deletion spec/api/endpoints/slack_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@
channel: 'C1',
ts: '1547842100.001400',
unfurls: {
activity.strava_url => activity.to_slack_attachment
activity.strava_url => { 'blocks' => activity.to_slack_blocks }
}.to_json
)

Expand Down

0 comments on commit 930c645

Please sign in to comment.