Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
apuntovanini committed Aug 26, 2024
2 parents da86b23 + a58b465 commit a187ab1
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 32 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: build
on:
push:
branches:
- '**'
- '!images'
- 'master'
- 'development'
pull_request:
branches:
- '**'
Expand All @@ -23,34 +23,37 @@ jobs:
- gemfiles/Gemfile.rails-6.0
- gemfiles/Gemfile.rails-6.1
- gemfiles/Gemfile.rails-7.0
- gemfiles/Gemfile.rails-7.1
orm:
- active_record
- mongoid
- dynamoid
include:
# https://www.ruby-lang.org/en/downloads
- gemfile: gemfiles/Gemfile.rails-5.0
ruby-version: 2.7.5
ruby-version: 2.7.7
- gemfile: gemfiles/Gemfile.rails-5.1
ruby-version: 2.7.5
ruby-version: 2.7.7
- gemfile: gemfiles/Gemfile.rails-5.2
ruby-version: 2.7.5
ruby-version: 2.7.7
- gemfile: gemfiles/Gemfile.rails-6.0
ruby-version: 3.0.3
ruby-version: 2.7.7
- gemfile: gemfiles/Gemfile.rails-6.1
ruby-version: 3.0.3
ruby-version: 2.7.7
- gemfile: gemfiles/Gemfile.rails-7.0
ruby-version: 3.0.3
ruby-version: 3.1.6
- gemfile: gemfiles/Gemfile.rails-7.1
ruby-version: 3.2.4
- gemfile: Gemfile
ruby-version: 3.0.3
ruby-version: 3.3.3
orm: active_record
test-db: mysql
- gemfile: Gemfile
ruby-version: 3.0.3
ruby-version: 3.3.3
orm: active_record
test-db: postgresql
- gemfile: Gemfile
ruby-version: 3.0.3
ruby-version: 3.3.3
orm: mongoid
test-db: mongodb
- gemfile: Gemfile
Expand All @@ -64,6 +67,8 @@ jobs:
orm: dynamoid
- gemfile: gemfiles/Gemfile.rails-7.0
orm: dynamoid
- gemfile: gemfiles/Gemfile.rails-7.1
orm: dynamoid

env:
RAILS_ENV: test
Expand Down Expand Up @@ -97,10 +102,10 @@ jobs:
- 27017:27017
env:
MONGO_INITDB_DATABASE: activity_notification_test
options: --health-cmd mongo --health-interval 10s --health-timeout 5s --health-retries 5
options: --health-cmd mongosh --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 2.3.1 / 2024-07-23
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.3.0...v2.3.1)

Bug Fixes:

* Fix serialize arguments for Rails 7.1 - [#178](https://github.com/simukappu/activity_notification/issues/178) [#179](https://github.com/simukappu/activity_notification/pull/179)

## 2.3.0 / 2024-06-02
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.2.4...v2.3.0)

Enhancements:

* Allow use with Rails 7.1 - [#173](https://github.com/simukappu/activity_notification/issues/173) [#177](https://github.com/simukappu/activity_notification/pull/177)

## 2.2.4 / 2023-03-20
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.2.3...v2.2.4)

Bug Fixes:

* Fix broken serialization with Rails security patch - [#166](https://github.com/simukappu/activity_notification/issues/166) [#167](https://github.com/simukappu/activity_notification/pull/167)

## 2.2.3 / 2022-02-12
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v2.2.2...v2.2.3)

Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ source 'https://rubygems.org'

gemspec

gem 'rails', '~> 6.0.0'
gem 'rails', '~> 7.1.0'

group :production do
gem 'sprockets-rails'
gem 'puma'
gem 'pg'
gem 'devise'
Expand All @@ -20,7 +21,7 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end
Expand Down
4 changes: 2 additions & 2 deletions activity_notification.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Gem::Specification.new do |s|
s.add_dependency 'swagger-blocks', '>= 3.0.0'

s.add_development_dependency 'puma', '>= 3.12.0'
s.add_development_dependency 'sqlite3', '>= 1.3.13'
s.add_development_dependency 'sqlite3', '>= 1.3.13', '< 2.0'
s.add_development_dependency 'mysql2', '>= 0.5.2'
s.add_development_dependency 'pg', '>= 1.0.0'
s.add_development_dependency 'mongoid', '>= 4.0.0'
s.add_development_dependency 'mongoid', '>= 4.0.0', '< 9.0'
s.add_development_dependency 'dynamoid', '3.1.0'
s.add_development_dependency 'rspec-rails', '>= 3.8.0'
s.add_development_dependency 'factory_bot_rails', '>= 4.11.0', '< 5.0.0'
Expand Down
16 changes: 16 additions & 0 deletions docs/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ The same can be done for the subscription table name, e.g., if you're using the
config.subscription_table_name = "notifications_subscriptions"
```

If you're redefining `yaml_column_permitted_classes` in *config/application.rb*, then you need to add a few classes to the whitelist to make sure *activity_notification* still works as expected.

```ruby
config.active_record.yaml_column_permitted_classes ||= []

# your override(s), e.g: MyWhitelistedClass
config.active_record.yaml_column_permitted_classes << MyWhitelistedClass

# overrides required for activity_notification to work
config.yaml_column_permitted_classes << ActiveSupport::HashWithIndifferentAccess
config.yaml_column_permitted_classes << ActiveSupport::TimeWithZone
config.yaml_column_permitted_classes << ActiveSupport::TimeZone
config.yaml_column_permitted_classes << Symbol
config.yaml_column_permitted_classes << Time
```

#### Using Mongoid ORM

When you use *activity_notification* with [Mongoid](http://mongoid.org) ORM, set **AN_ORM** environment variable to **mongoid**:
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.rails-5.0
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/Gemfile.rails-5.1
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
gem 'mongoid', '>= 4.0.0', '< 8.0'
end

gem 'dotenv-rails', groups: [:development, :test]
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.rails-5.2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/Gemfile.rails-6.0
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
gemspec path: '../'

gem 'rails', '~> 6.0.0'
gem 'psych', '< 4'

group :development do
gem 'bullet'
Expand All @@ -14,7 +15,7 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.rails-6.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end
Expand Down
7 changes: 1 addition & 6 deletions gemfiles/Gemfile.rails-7.0
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ source 'https://rubygems.org'
gemspec path: '../'

gem 'rails', '~> 7.0.0'
# https://github.com/lynndylanhurley/devise_token_auth/pull/1517
gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth.git'
# https://jira.mongodb.org/browse/MONGOID-5193
gem 'mongoid', git: 'https://github.com/mongodb/mongoid.git'

gem 'sprockets-rails'

group :development do
Expand All @@ -20,7 +15,7 @@ group :test do
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end
Expand Down
23 changes: 23 additions & 0 deletions gemfiles/Gemfile.rails-7.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
source 'https://rubygems.org'

gemspec path: '../'

gem 'rails', '~> 7.1.0'
gem 'sprockets-rails'

group :development do
gem 'bullet'
gem 'rack-cors'
end

group :test do
gem 'rails-controller-testing'
gem 'ammeter'
gem 'timecop'
gem 'committee'
gem 'committee-rails', '< 0.6'
# gem 'coveralls', require: false
gem 'coveralls_reborn', require: false
end

gem 'dotenv-rails', groups: [:development, :test]
8 changes: 7 additions & 1 deletion lib/activity_notification/orm/active_record/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ class Notification < ::ActiveRecord::Base
belongs_to :notifier, polymorphic: true, optional: true

# Serialize parameters Hash
serialize :parameters, Hash
# :nocov:
if Rails.gem_version >= Gem::Version.new('7.1')
serialize :parameters, type: Hash, coder: YAML
else
serialize :parameters, Hash
end
# :nocov:

validates :target, presence: true
validates :notifiable, presence: true
Expand Down
8 changes: 7 additions & 1 deletion lib/activity_notification/orm/active_record/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ class Subscription < ::ActiveRecord::Base
belongs_to :target, polymorphic: true

# Serialize parameters Hash
serialize :optional_targets, Hash
# :nocov:
if Rails.gem_version >= Gem::Version.new('7.1')
serialize :optional_targets, type: Hash, coder: YAML
else
serialize :optional_targets, Hash
end
# :nocov:

validates :target, presence: true
validates :key, presence: true, uniqueness: { scope: :target }
Expand Down
2 changes: 1 addition & 1 deletion lib/activity_notification/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ActivityNotification
VERSION = "2.2.3"
VERSION = "2.3.1"
end
2 changes: 1 addition & 1 deletion spec/concerns/renderable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
test_instance.target = create(:admin)
test_instance.key = "notification.#{simple_text_key}"
expect(test_instance.text)
.to eq("translation missing: en.notification.admin.#{simple_text_key}.text")
.to eq("Translation missing: en.notification.admin.#{simple_text_key}.text")
end
end

Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def clean_database
end

RSpec.configure do |config|
config.expect_with :minitest, :rspec
config.include FactoryBot::Syntax::Methods
config.before(:each) do
FactoryBot.reload
Expand Down

0 comments on commit a187ab1

Please sign in to comment.