flipper-notifications 0.1.8 → 0.1.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff442c70503428b1f63823b188f1abb61827b32bd3b673d7c390435340617629
4
- data.tar.gz: 8f3565b25fe5c4749d4fc1dc39677e95d6f59cc30beea1af1a3c7e78b82f5c91
3
+ metadata.gz: 5f6ffe2530157b223628713342f83960c5a89dc2a8fca928df146c9553552279
4
+ data.tar.gz: c4fba936bef2a2629c6171bfd2418a08c7b8b379b12b87cbcc97808f0b8a4815
5
5
  SHA512:
6
- metadata.gz: fa218d4174f1a466de4769628005e82b0d0bb5451883906b8334ba311b7abc409aee3bea89a2fac6765b524e71d09420d155ae00d9970dd3b7a573aee6859037
7
- data.tar.gz: 7c92da7a2936914cd47cc4c6a52d7254b1d4b7193dfc7b130f885b7f3d0be5c6d769d1d8a41dba82883ceece127242d997fcc4ead40698d43bb0e4d461513197
6
+ metadata.gz: c576ff049c4ff0000dc628793e293a83e6a8814d0d73278bb62094207133c64860f0dc43028a800fd6e2b0072ff86a7bf01a790b20b70db5055eda9e73ca4ec9
7
+ data.tar.gz: 54d2344c796fbafa721d18e55cfc68d46bd703df8a7b06bb9e5ef38b27171c144fb9757492ce26428937febaa6bdeeae2c24abdb07aa4243db7866153ad8cc55
data/.rubocop.yml CHANGED
@@ -30,6 +30,9 @@ Metrics/CyclomaticComplexity:
30
30
  Metrics/MethodLength:
31
31
  Enabled: false
32
32
 
33
+ Metrics/PerceivedComplexity:
34
+ Enabled: false
35
+
33
36
  Style/Documentation:
34
37
  Enabled: false
35
38
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flipper-notifications (0.1.8)
4
+ flipper-notifications (0.1.10)
5
5
  activesupport (>= 7, < 8.2)
6
6
  flipper (>= 0.24, < 2.0)
7
7
  httparty (~> 0.17)
data/README.md CHANGED
@@ -53,6 +53,26 @@ Flipper::Notifications.configure do |config|
53
53
  end
54
54
  ```
55
55
 
56
+ ### Slack invalid_blocks Errors
57
+
58
+ Slack limits the size of webhook messages. The Slack API returns a 400 status
59
+ code in these cases with a message of `invalid_blocks`. If your feature is
60
+ enabled for a lot of actors or a lot of groups, the length of the list of
61
+ actor or group names can exceed Slack's limit. To avoid these errors, you
62
+ may configure a character limit sent in webhooks by configuring a
63
+ `webhook_character_limit` in your initializer:
64
+
65
+ ```ruby
66
+ # config/initializers/flipper.rb
67
+
68
+ Flipper::Notifications.configure do |config|
69
+ config.webhook_character_limit = 3_000
70
+ end
71
+ ```
72
+
73
+ If you set this value, webhook messages will be shortened whenever they
74
+ exceed the configured character limit.
75
+
56
76
  ### Implementing Your Own Webhooks
57
77
 
58
78
  This gem provides an implementation to send notifications to Slack via an
@@ -163,3 +183,11 @@ The gem is available as open source under the terms of the
163
183
  Everyone interacting in the Flipper::Notifications project’s codebases,
164
184
  issue trackers, chat rooms and mailing lists is expected to follow the
165
185
  [code of conduct](https://github.com/[USERNAME]/flipper-notifications/blob/master/CODE_OF_CONDUCT.md).
186
+
187
+ ## Disclaimer
188
+
189
+ This project is provided as open source under the MIT License and is made available on an **"as is"** basis, without warranty of any kind, express or implied.
190
+
191
+ This repository is **not an official Wrapbook product**. Wrapbook makes no commitments regarding ongoing development, maintenance, bug fixes, security updates, or compatibility.
192
+
193
+ Use of this project is at your own risk.
@@ -7,9 +7,10 @@ module Flipper
7
7
  def initialize
8
8
  @enabled = false
9
9
  @notifiers = []
10
+ @webhook_character_limit = nil
10
11
  end
11
12
 
12
- attr_accessor :enabled, :notifiers
13
+ attr_accessor :enabled, :notifiers, :webhook_character_limit
13
14
 
14
15
  def enabled?
15
16
  @enabled
@@ -40,7 +40,7 @@ module Flipper
40
40
  def feature_enabled_settings_markdown
41
41
  return "" unless feature.conditional?
42
42
 
43
- [].tap do |settings|
43
+ markdown = [].tap do |settings|
44
44
  settings << "The feature is now enabled for:" if feature.conditional?
45
45
 
46
46
  settings << "- Groups: #{to_sentence(feature.enabled_groups.map(&:name).sort)}" if feature.enabled_groups.any?
@@ -53,6 +53,11 @@ module Flipper
53
53
 
54
54
  settings << "- #{feature.percentage_of_time_value}% of the time" if feature.percentage_of_time_value.positive?
55
55
  end.join("\n")
56
+
57
+ character_limit = Flipper::Notifications.configuration.webhook_character_limit
58
+ return markdown if character_limit.nil? || markdown.length <= character_limit
59
+
60
+ shortened_feature_enabled_settings_markdown[0...character_limit]
56
61
  end
57
62
 
58
63
  def noteworthy?
@@ -97,6 +102,21 @@ module Flipper
97
102
  end
98
103
  end
99
104
 
105
+ def shortened_feature_enabled_settings_markdown
106
+ [].tap do |settings|
107
+ settings << "The feature is now enabled for:" if feature.conditional?
108
+
109
+ settings << "#{feature.enabled_groups.size} Groups" if feature.enabled_groups.any?
110
+ settings << "#{feature.actors_value.size} Actors" if feature.actors_value.any?
111
+
112
+ if feature.percentage_of_actors_value.positive?
113
+ settings << "- #{feature.percentage_of_actors_value}% of actors"
114
+ end
115
+
116
+ settings << "- #{feature.percentage_of_time_value}% of the time" if feature.percentage_of_time_value.positive?
117
+ end.join("\n")
118
+ end
119
+
100
120
  end
101
121
  end
102
122
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Flipper
4
4
  module Notifications
5
- VERSION = "0.1.8"
5
+ VERSION = "0.1.10"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-notifications
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Lubrano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-29 00:00:00.000000000 Z
11
+ date: 2026-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport