message_bus 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of message_bus might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe33cef07b7712b1bbcc2ab444e123fd1121665a5ecf1db7fb24dba190e48b38
4
- data.tar.gz: 325300ad20aeb221d468326247c7755022dc8e594e8de1311601dec89b4a2c2b
3
+ metadata.gz: 7ff8ef38b49e1ca6d2fa08b0f56a62929247d71256ea5e717c2952dde35b63bf
4
+ data.tar.gz: 158ca236805f872f60737d3af030bb38319c0b7355499b9c9d26006cb001121f
5
5
  SHA512:
6
- metadata.gz: 216a6156aad68865beb14a519bda4f709e10d96bcc8c58fa4bc042ef596fd7563926517f5b5c82d547f4ff26ce7bd3ac0a74998ce9cf7b4b2d66c792f049c602
7
- data.tar.gz: fb521cf6b6928586f7ba1f2da19a8def8d3f77acc0d6cb1c417fe03d8a36f0af8a470c29cc26ce400c12ba8648223ded2de43109a4616b5c89b967ed4e6a67aa
6
+ metadata.gz: b8b0a6c5079e5a1fd025dbaa8bde07140160fc9041ee7ac25defb32fb658c5817472efe1a98f25875e67e74ce81d1ff20ab32209f89af995ff87529bb5c8da92
7
+ data.tar.gz: 40baa9cb6ca20f986591ee766f1c52fbc6a73595b5beca94f2d80be1211915668f5555fd4a1c9db80b9ddf191e3dd065d9d244c4356b8c47420aca62102cb375
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ - Version 3.2.0
2
+
3
+ - FIX: compatability with Rails 6.0.3, note: apps without ActionDispatch::Flash may stop working after this upgrade
4
+ to correct this disable middleware injection with `config.skip_message_bus_middleware = true` and configure middleware by hand with `app.middleware.use(MessageBus::Rack::Middleware)`
5
+
1
6
  28-04-2020
2
7
 
3
8
  - Version 3.1.0
@@ -11,27 +11,29 @@ class MessageBus::Rails::Railtie < ::Rails::Railtie
11
11
  # the Rails app is configured that might be ActionDispatch::Session::CookieStore, or potentially
12
12
  # ActionDispatch::Session::ActiveRecordStore.
13
13
  #
14
- # To handle either case, we insert it before ActionDispatch::Flash.
15
- #
16
- # For APIs or apps that have ActionDispatch::Flash deleted from the middleware
17
- # stack we just push MessageBus to the bottom.
18
- if api_only?(app.config) || flash_middleware_deleted?(app.middleware)
19
- app.middleware.use(MessageBus::Rack::Middleware)
20
- else
21
- app.middleware.insert_before(ActionDispatch::Flash, MessageBus::Rack::Middleware)
14
+ # given https://github.com/rails/rails/commit/fedde239dcee256b417dc9bcfe5fef603bf0d952#diff-533a9a9cc17a8a899cb830626089e5f9
15
+ # there is no way of walking the stack for operations
16
+ if !skip_middleware?(app.config)
17
+ if api_only?(app.config)
18
+ app.middleware.use(MessageBus::Rack::Middleware)
19
+ else
20
+ app.middleware.insert_before(ActionDispatch::Flash, MessageBus::Rack::Middleware)
21
+ end
22
22
  end
23
23
 
24
24
  MessageBus.logger = Rails.logger
25
25
  end
26
26
 
27
+ def skip_middleware?(config)
28
+ return false if !config.respond_to?(:skip_message_bus_middleware)
29
+
30
+ config.skip_message_bus_middleware
31
+ end
32
+
27
33
  def api_only?(config)
28
- return false unless config.respond_to?(:api_only)
34
+ return false if !config.respond_to?(:api_only)
29
35
 
30
36
  config.api_only
31
37
  end
32
38
 
33
- def flash_middleware_deleted?(middleware)
34
- ops = middleware.instance_variable_get(:@operations)
35
- ops.any? { |m| m[0] == :delete && m[1].include?(ActionDispatch::Flash) }
36
- end
37
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MessageBus
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack