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 +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +28 -0
- data/lib/flipper/notifications/configuration.rb +2 -1
- data/lib/flipper/notifications/feature_event.rb +21 -1
- data/lib/flipper/notifications/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f6ffe2530157b223628713342f83960c5a89dc2a8fca928df146c9553552279
|
|
4
|
+
data.tar.gz: c4fba936bef2a2629c6171bfd2418a08c7b8b379b12b87cbcc97808f0b8a4815
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c576ff049c4ff0000dc628793e293a83e6a8814d0d73278bb62094207133c64860f0dc43028a800fd6e2b0072ff86a7bf01a790b20b70db5055eda9e73ca4ec9
|
|
7
|
+
data.tar.gz: 54d2344c796fbafa721d18e55cfc68d46bd703df8a7b06bb9e5ef38b27171c144fb9757492ce26428937febaa6bdeeae2c24abdb07aa4243db7866153ad8cc55
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
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.
|
|
@@ -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
|
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.
|
|
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:
|
|
11
|
+
date: 2026-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|