diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8905680..cc738d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,12 +16,19 @@ jobs: lint: true - ruby: "3.4" lint: true - name: 💎 Ruby ${{ matrix.ruby }} + # Exercise jwt v3 alongside the default v2 resolution. + - ruby: "4.0" + jwt: "~> 3.0" + name: 💎 Ruby ${{ matrix.ruby }}${{ matrix.jwt && format(' (jwt {0})', matrix.jwt) || '' }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # gives the commit linter access to previous commits + - name: Pin jwt to ${{ matrix.jwt }} + if: matrix.jwt + run: echo "gem 'jwt', '${{ matrix.jwt }}'" >> Gemfile + - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} diff --git a/docs/best_practices/moderation.md b/docs/best_practices/moderation.md index e4c2e86..915bfde 100644 --- a/docs/best_practices/moderation.md +++ b/docs/best_practices/moderation.md @@ -99,7 +99,7 @@ client.update_channel_type( ### Blocklist -A Blocklist is a list of words that you can use to moderate chat messages. Stream Chat comes with a built-in Blocklist called `profanity_en_2020_v1` which contains over a thousand of the most common profane words. +A Blocklist is a list of words that you can use to moderate chat messages. Stream Chat comes with a built-in Blocklist called `profanity` which contains over a thousand of the most common profane words. You can manage your own blocklists via the Stream dashboard or APIs to a manage blocklists and configure your channel types to use them. Channel types can be configured to block or flag messages from your users based on your blocklists. To do this you need to configure your channel type(s) with these two configurations: `blocklist` and `blocklist_behavior` . The first one refers to the name of the blocklist and the second must be set as `block` or `flag` . @@ -145,7 +145,7 @@ client.update_channel_type("messaging", blocklist: "no-cakes", blocklist_behavio #### List available blocklists -All applications have the `profanity_en_2020_v1` blocklist available. This endpoint returns all blocklists available for this application. +All applications have the `profanity` blocklist available. This endpoint returns all blocklists available for this application. ```ruby client.list_blocklists() diff --git a/docs/webhooks/webhook_events.md b/docs/webhooks/webhook_events.md index a87ef06..bec85dd 100644 --- a/docs/webhooks/webhook_events.md +++ b/docs/webhooks/webhook_events.md @@ -574,7 +574,7 @@ When applicable, the following attributes are included to the event user and to "blocklist_behavior": "flag", "blocklists": [ { - "blocklist": "profanity_en_2020_v1", + "blocklist": "profanity", "behavior": "block" } ], @@ -877,7 +877,7 @@ When applicable, the following attributes are included to the event user and to "max_message_length": 5000, "automod": "disabled", "automod_behavior": "flag", - "blocklist": "profanity_en_2020_v1", + "blocklist": "profanity", "blocklist_behavior": "block", "automod_thresholds": {}, "commands": [ diff --git a/lib/stream-chat/client.rb b/lib/stream-chat/client.rb index e9a14ea..e5503c4 100644 --- a/lib/stream-chat/client.rb +++ b/lib/stream-chat/client.rb @@ -20,7 +20,7 @@ require 'stream-chat/channel_batch_updater' module StreamChat - DEFAULT_BLOCKLIST = 'profanity_en_2020_v1' + DEFAULT_BLOCKLIST = 'profanity' SOFT_DELETE = 'soft' HARD_DELETE = 'hard' @@ -739,7 +739,7 @@ def create_guest(user) # Returns all blocklists. # # A Block List is a list of words that you can use to moderate chat messages. Stream Chat - # comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand + # comes with a built-in Block List called profanity which contains over a thousand # of the most common profane words. # You can manage your own block lists via the Stream dashboard or APIs to a manage # blocklists and configure your channel types to use them. @@ -751,7 +751,7 @@ def list_blocklists # Returns a blocklist. # # A Block List is a list of words that you can use to moderate chat messages. Stream Chat - # comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand + # comes with a built-in Block List called profanity which contains over a thousand # of the most common profane words. # You can manage your own block lists via the Stream dashboard or APIs to a manage # blocklists and configure your channel types to use them. @@ -763,7 +763,7 @@ def get_blocklist(name) # Creates a blocklist. # # A Block List is a list of words that you can use to moderate chat messages. Stream Chat - # comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand + # comes with a built-in Block List called profanity which contains over a thousand # of the most common profane words. # You can manage your own block lists via the Stream dashboard or APIs to a manage # blocklists and configure your channel types to use them. @@ -775,7 +775,7 @@ def create_blocklist(name, words) # Updates a blocklist. # # A Block List is a list of words that you can use to moderate chat messages. Stream Chat - # comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand + # comes with a built-in Block List called profanity which contains over a thousand # of the most common profane words. # You can manage your own block lists via the Stream dashboard or APIs to a manage # blocklists and configure your channel types to use them. @@ -787,7 +787,7 @@ def update_blocklist(name, words) # Deletes a blocklist. # # A Block List is a list of words that you can use to moderate chat messages. Stream Chat - # comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand + # comes with a built-in Block List called profanity which contains over a thousand # of the most common profane words. # You can manage your own block lists via the Stream dashboard or APIs to a manage # blocklists and configure your channel types to use them. diff --git a/sorbet/rbi/hidden-definitions/hidden.rbi b/sorbet/rbi/hidden-definitions/hidden.rbi index a82e732..664d182 100644 --- a/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/sorbet/rbi/hidden-definitions/hidden.rbi @@ -8698,8 +8698,6 @@ end class StringScanner def bol?(); end - - def initialize(*arg); end Id = ::T.let(nil, ::T.untyped) Version = ::T.let(nil, ::T.untyped) end diff --git a/spec/client_spec.rb b/spec/client_spec.rb index c60452d..b120f1e 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -118,7 +118,7 @@ def loop_times(times) it 'creates a user token' do token = @client.create_token('tommaso') - payload = JWT.decode(token, @client.api_secret) + payload = JWT.decode(token, @client.api_secret, true, { algorithm: 'HS256' }) expect(payload[0].fetch('user_id')).to eq 'tommaso' end diff --git a/spec/moderation_spec.rb b/spec/moderation_spec.rb index ec7faf1..cb83ed3 100644 --- a/spec/moderation_spec.rb +++ b/spec/moderation_spec.rb @@ -197,7 +197,7 @@ def loop_times(times) enabled: true, rules: [ { - name: 'profanity_en_2020_v1', + name: StreamChat::DEFAULT_BLOCKLIST, action: 'flag' } ] diff --git a/stream-chat.gemspec b/stream-chat.gemspec index 9a84d11..523b44b 100644 --- a/stream-chat.gemspec +++ b/stream-chat.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |gem| gem.add_dependency 'faraday', '~> 2.12' gem.add_dependency 'faraday-multipart', '~> 1.1' gem.add_dependency 'faraday-net_http_persistent', '~> 2.3' - gem.add_dependency 'jwt', '~> 2.10' + gem.add_dependency 'jwt', '>= 2.10', '< 4' gem.add_dependency 'net-http-persistent', '~> 4.0' gem.add_dependency 'sorbet-runtime', '>= 0.5.11820', '< 1' end