grape-slack-bot 1.6.9 → 1.6.10

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: f90d900df6a6bcab262e5479a71d1be2e5ed088dc896f2f05e55fc6b7b8a8dba
4
- data.tar.gz: f21f2799f1c828d0f57449201090044b591a5277124f47259b283dbb1ece9c65
3
+ metadata.gz: 182ee366d5e5d1fb89152bcd753a75e4361b8f611fa1d9ca0a4b81dc5f6221ab
4
+ data.tar.gz: 49f18848a1abef7bf401eb3af87a2037ba25850d0a9043428a4f44cba6bd2371
5
5
  SHA512:
6
- metadata.gz: 8f8c4dd245b689378703f5c9c7c3b26bea0c7d85c9ef5df0a4a4cd36c8b32625af795ac8bfdfacd512f54676017635b6725fe30222427ca70dc152b5cfb8a297
7
- data.tar.gz: abce9cdd4da556f77912c53211322e22bb9f85bd4ef537528997f71b15ecee50ee54a9ddf029908c85f63f7c93743bb173322130d217d8bc223d22a89ce4f641
6
+ metadata.gz: 8379e1b62eb08f3dcf9507dffa299ac07d4c4753ac544e502ecef8f28107f7166df66c8f2783a338e58cd1a41f8f5702678650ac19aad100c597300097bb330e
7
+ data.tar.gz: 7ee9589a200c7c105948df9751878ebf231430b3aa6313cfc86533de254e0340e01205e2d339810741fe7c2411c368083a1924511280671de63cb9be2d87f0ca
@@ -9,7 +9,7 @@ module SlackBot
9
9
  include SlackBot::Concerns::ViewKlass
10
10
 
11
11
  def self.open_modal(callback:, trigger_id:, view:)
12
- view = view.merge({ type: "modal", callback_id: callback.id })
12
+ view = view.merge({ type: "modal", callback_id: callback&.id })
13
13
  response =
14
14
  SlackBot::ApiClient.new.views_open(trigger_id: trigger_id, view: view)
15
15
 
@@ -18,13 +18,15 @@ module SlackBot
18
18
  end
19
19
 
20
20
  view_id = response.data.dig("view", "id")
21
- callback.view_id = view_id if view_id.present?
22
-
23
- SlackViewsReply.new(callback.id, view_id)
21
+ if callback.present? && view_id.present?
22
+ callback.view_id = view_id
23
+ callback.save
24
+ end
25
+ SlackViewsReply.new(callback&.id, view_id)
24
26
  end
25
27
 
26
28
  def self.update_modal(callback:, view_id:, view:)
27
- view = view.merge({ type: "modal", callback_id: callback.id })
29
+ view = view.merge({ type: "modal", callback_id: callback&.id })
28
30
  response =
29
31
  SlackBot::ApiClient.new.views_update(view_id: view_id, view: view)
30
32
 
@@ -33,9 +35,11 @@ module SlackBot
33
35
  end
34
36
 
35
37
  view_id = response.data.dig("view", "id")
36
- callback.view_id = view_id if view_id.present?
37
-
38
- SlackViewsReply.new(callback.id, view_id)
38
+ if callback.present? && view_id.present?
39
+ callback.view_id = view_id
40
+ callback.save
41
+ end
42
+ SlackViewsReply.new(callback&.id, view_id)
39
43
  end
40
44
 
41
45
  def self.publish_view(callback: nil, metadata: nil, user_id:, view:)
@@ -49,9 +53,11 @@ module SlackBot
49
53
  end
50
54
 
51
55
  view_id = response.data.dig("view", "id")
52
- callback.view_id = view_id if view_id.present? && callback.present?
53
-
54
- SlackViewsReply.new(callback.id, view_id)
56
+ if callback.present? && view_id.present?
57
+ callback.view_id = view_id
58
+ callback.save
59
+ end
60
+ SlackViewsReply.new(callback&.id, view_id)
55
61
  end
56
62
 
57
63
  attr_reader :current_user, :params, :callback, :config
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.6.9'.freeze
25
+ VERSION = '1.6.10'.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.6.9
4
+ version: 1.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov