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 +4 -4
- data/README.md +7 -0
- data/lib/slack_bot/grape_extension.rb +3 -4
- data/lib/slack_bot/interaction.rb +7 -8
- data/lib/slack_bot.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20631471a50c1063efab2b44ebf94f2ccb3d4d8836eb52e0ec99d709e6e2e221
|
4
|
+
data.tar.gz: 4a956eb022a301cbcf0988a5b8fde6ff21c0fbbc30f94c6f966b4d0ca2febbb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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")
|
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.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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