grape-slack-bot 1.5.4 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7ec90d89547fb9fddd4972b16caad8cb96cc4f2163f82eebc40747d2ca79c1f
4
- data.tar.gz: bf2fa99739aa63e4e0e63425abde569021d1e0ec061f155c3e07e58b966f2115
3
+ metadata.gz: 20631471a50c1063efab2b44ebf94f2ccb3d4d8836eb52e0ec99d709e6e2e221
4
+ data.tar.gz: 4a956eb022a301cbcf0988a5b8fde6ff21c0fbbc30f94c6f966b4d0ca2febbb6
5
5
  SHA512:
6
- metadata.gz: 94aed6e295eb7150315c9bcc40fe3be10d5de81b257178e5691918b5ff3832f21622655b779c9ab6fcfd3aa4a9377870da16b91c6f9e69fc74d443f034e83b10
7
- data.tar.gz: 5857289c58cb8bec70b25067848c623e0c60b5450562efa1ba48859b59271b0a10b08a807e662c1bfdfdabfd48e952be60f290f3395af01dd34b6e7925fced8f
6
+ metadata.gz: e30000e0c25fd8722fb53d3da386a3e78dd9f8cc490f49e434390c4b256b2450eb5f0542d7f21a30037856d9b197e538cb51f384866b52bd4ea3bcc633e623dc
7
+ data.tar.gz: 1718485fcfabf43fff9a81fac46fe3b68c285a10e2b7b35b2babfceac5a14a110cacfae9accb81d57f49578c7cab3dd5dfeb5b5ef127bea91fcfcc197e8a2592
data/README.md CHANGED
@@ -452,6 +452,13 @@ module MySlackBot
452
452
  class AppHomeOpenedEvent < SlackBot::Event
453
453
  view MySlackBot::AppHomeView
454
454
  def call
455
+ # NOTE: we have to create callback here in order to handle interactions
456
+ self.callback = SlackBot::Callback.find_or_create(
457
+ id: "app_home_opened",
458
+ user: current_user,
459
+ class_name: VacationsBot::AppHomeInteraction.name
460
+ )
461
+
455
462
  publish_view :index_view
456
463
  end
457
464
  end
@@ -8,12 +8,11 @@ module SlackBot
8
8
  base.use ActionDispatch::RemoteIp
9
9
  base.helpers do
10
10
  def fetch_team_id
11
- params.dig("team_id") || params.dig("team", "id") || params.dig("payload", "user", "team_id")
11
+ params.dig("team_id") || params.dig("team", "id")
12
12
  end
13
13
 
14
14
  def fetch_user_id
15
- params.dig("user_id") || params.dig("user", "id") ||
16
- params.dig("event", "user") || params.dig("payload", "user", "id")
15
+ params.dig("user_id") || params.dig("user", "id") || params.dig("event", "user")
17
16
  end
18
17
 
19
18
  def verify_slack_signature!
@@ -85,7 +84,7 @@ module SlackBot
85
84
  def handle_block_actions_view(view:, user:, params:)
86
85
  callback_id = view&.dig("callback_id")
87
86
 
88
- callback = SlackBot::Callback.find(callback_id, config: config)
87
+ callback = SlackBot::Callback.find(callback_id, user: user, config: config)
89
88
  raise SlackBot::Errors::CallbackNotFound.new if callback.blank?
90
89
 
91
90
  SlackBot::DevConsole.log_check "SlackApi::Interactions##{__method__}: #{callback.id} #{callback.payload} #{callback.user_id} #{user&.id}"
@@ -47,14 +47,13 @@ module SlackBot
47
47
  channel_id: nil,
48
48
  config: nil
49
49
  )
50
- callback = Callback.find(callback_id, config: config) if callback_id.present?
51
- callback ||=
52
- Callback.create(
53
- class_name: class_name,
54
- user: user,
55
- channel_id: channel_id,
56
- config: config
57
- )
50
+ callback = Callback.find_or_create(
51
+ id: callback_id,
52
+ class_name: class_name,
53
+ user: user,
54
+ channel_id: channel_id,
55
+ config: config
56
+ )
58
57
 
59
58
  view = payload.merge({ type: "modal", callback_id: callback.id })
60
59
  response =
data/lib/slack_bot.rb CHANGED
@@ -22,5 +22,5 @@ require 'slack_bot/pager'
22
22
  require 'slack_bot/grape_extension'
23
23
 
24
24
  module SlackBot
25
- VERSION = '1.5.4'.freeze
25
+ VERSION = '1.5.6'.freeze
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-slack-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov