activity_notification 2.4.1 → 2.5.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.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/app/jobs/activity_notification/cascading_notification_job.rb +123 -0
- data/docs/Functions.md +197 -1
- data/lib/activity_notification/apis/cascading_notification_api.rb +208 -0
- data/lib/activity_notification/apis/notification_api.rb +3 -0
- data/lib/activity_notification/config.rb +10 -0
- data/lib/activity_notification/mailers/helpers.rb +27 -1
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/templates/activity_notification.rb +8 -0
- metadata +5 -441
- data/.codeclimate.yml +0 -33
- data/.coveralls.yml +0 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -22
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- data/.github/pull_request_template.md +0 -13
- data/.github/workflows/build.yml +0 -100
- data/.gitignore +0 -74
- data/.rspec +0 -3
- data/.rubocop.yml +0 -1157
- data/.yardopts +0 -6
- data/CHANGELOG.md +0 -452
- data/Gemfile +0 -31
- data/Procfile +0 -2
- data/Rakefile +0 -28
- data/activity_notification.gemspec +0 -44
- data/ai-curated-specs/issues/172/design.md +0 -220
- data/ai-curated-specs/issues/172/tasks.md +0 -326
- data/ai-curated-specs/issues/188/design.md +0 -227
- data/ai-curated-specs/issues/188/requirements.md +0 -78
- data/ai-curated-specs/issues/188/tasks.md +0 -203
- data/ai-curated-specs/issues/188/upstream-contributions.md +0 -592
- data/ai-curated-specs/issues/50/design.md +0 -235
- data/ai-curated-specs/issues/50/requirements.md +0 -49
- data/ai-curated-specs/issues/50/tasks.md +0 -232
- data/bin/_dynamodblocal +0 -4
- data/bin/bundle_update.sh +0 -7
- data/bin/deploy_on_heroku.sh +0 -16
- data/bin/install_dynamodblocal.sh +0 -5
- data/bin/start_dynamodblocal.sh +0 -47
- data/bin/stop_dynamodblocal.sh +0 -34
- data/gemfiles/Gemfile.rails-5.0 +0 -25
- data/gemfiles/Gemfile.rails-5.1 +0 -25
- data/gemfiles/Gemfile.rails-5.2 +0 -24
- data/gemfiles/Gemfile.rails-6.0 +0 -23
- data/gemfiles/Gemfile.rails-6.1 +0 -22
- data/gemfiles/Gemfile.rails-7.0 +0 -25
- data/gemfiles/Gemfile.rails-7.1 +0 -23
- data/gemfiles/Gemfile.rails-7.2 +0 -23
- data/gemfiles/Gemfile.rails-8.0 +0 -24
- data/package.json +0 -8
- data/spec/channels/notification_api_channel_shared_examples.rb +0 -59
- data/spec/channels/notification_api_channel_spec.rb +0 -49
- data/spec/channels/notification_api_with_devise_channel_spec.rb +0 -76
- data/spec/channels/notification_channel_shared_examples.rb +0 -59
- data/spec/channels/notification_channel_spec.rb +0 -48
- data/spec/channels/notification_with_devise_channel_spec.rb +0 -97
- data/spec/concerns/apis/notification_api_spec.rb +0 -1627
- data/spec/concerns/apis/subscription_api_spec.rb +0 -474
- data/spec/concerns/common_spec.rb +0 -213
- data/spec/concerns/models/group_spec.rb +0 -61
- data/spec/concerns/models/notifiable_spec.rb +0 -782
- data/spec/concerns/models/notifier_spec.rb +0 -71
- data/spec/concerns/models/subscriber_spec.rb +0 -800
- data/spec/concerns/models/target_spec.rb +0 -1285
- data/spec/concerns/renderable_spec.rb +0 -129
- data/spec/config_spec.rb +0 -85
- data/spec/controllers/common_controller_spec.rb +0 -25
- data/spec/controllers/controller_spec_utility.rb +0 -100
- data/spec/controllers/dummy_common_controller.rb +0 -5
- data/spec/controllers/notifications_api_controller_shared_examples.rb +0 -619
- data/spec/controllers/notifications_api_controller_spec.rb +0 -19
- data/spec/controllers/notifications_api_with_devise_controller_spec.rb +0 -60
- data/spec/controllers/notifications_controller_shared_examples.rb +0 -743
- data/spec/controllers/notifications_controller_spec.rb +0 -11
- data/spec/controllers/notifications_with_devise_controller_spec.rb +0 -97
- data/spec/controllers/subscriptions_api_controller_shared_examples.rb +0 -750
- data/spec/controllers/subscriptions_api_controller_spec.rb +0 -19
- data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +0 -60
- data/spec/controllers/subscriptions_controller_shared_examples.rb +0 -946
- data/spec/controllers/subscriptions_controller_spec.rb +0 -11
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +0 -97
- data/spec/factories/admins.rb +0 -5
- data/spec/factories/articles.rb +0 -5
- data/spec/factories/comments.rb +0 -6
- data/spec/factories/dummy/dummy_group.rb +0 -4
- data/spec/factories/dummy/dummy_notifiable.rb +0 -4
- data/spec/factories/dummy/dummy_notifier.rb +0 -4
- data/spec/factories/dummy/dummy_subscriber.rb +0 -4
- data/spec/factories/dummy/dummy_target.rb +0 -4
- data/spec/factories/notifications.rb +0 -7
- data/spec/factories/subscriptions.rb +0 -8
- data/spec/factories/users.rb +0 -11
- data/spec/generators/controllers_generator_spec.rb +0 -85
- data/spec/generators/install_generator_spec.rb +0 -43
- data/spec/generators/migration/migration_generator_spec.rb +0 -80
- data/spec/generators/models_generator_spec.rb +0 -96
- data/spec/generators/views_generator_spec.rb +0 -195
- data/spec/helpers/polymorphic_helpers_spec.rb +0 -89
- data/spec/helpers/view_helpers_spec.rb +0 -547
- data/spec/jobs/notification_resilience_job_spec.rb +0 -167
- data/spec/jobs/notify_all_job_spec.rb +0 -23
- data/spec/jobs/notify_job_spec.rb +0 -23
- data/spec/jobs/notify_to_job_spec.rb +0 -23
- data/spec/mailers/mailer_spec.rb +0 -214
- data/spec/mailers/notification_resilience_spec.rb +0 -263
- data/spec/models/dummy/dummy_group_spec.rb +0 -10
- data/spec/models/dummy/dummy_notifiable_spec.rb +0 -10
- data/spec/models/dummy/dummy_notifier_spec.rb +0 -10
- data/spec/models/dummy/dummy_subscriber_spec.rb +0 -8
- data/spec/models/dummy/dummy_target_spec.rb +0 -10
- data/spec/models/notification_spec.rb +0 -472
- data/spec/models/subscription_spec.rb +0 -215
- data/spec/optional_targets/action_cable_api_channel_spec.rb +0 -34
- data/spec/optional_targets/action_cable_channel_spec.rb +0 -41
- data/spec/optional_targets/amazon_sns_spec.rb +0 -47
- data/spec/optional_targets/base_spec.rb +0 -45
- data/spec/optional_targets/slack_spec.rb +0 -44
- data/spec/orm/dynamoid_spec.rb +0 -115
- data/spec/rails_app/Rakefile +0 -15
- data/spec/rails_app/app/assets/config/manifest.js +0 -3
- data/spec/rails_app/app/assets/images/.keep +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +0 -3
- data/spec/rails_app/app/assets/javascripts/cable.js +0 -12
- data/spec/rails_app/app/assets/stylesheets/application.css +0 -15
- data/spec/rails_app/app/assets/stylesheets/reset.css +0 -85
- data/spec/rails_app/app/assets/stylesheets/style.css +0 -244
- data/spec/rails_app/app/controllers/admins_controller.rb +0 -21
- data/spec/rails_app/app/controllers/application_controller.rb +0 -5
- data/spec/rails_app/app/controllers/articles_controller.rb +0 -67
- data/spec/rails_app/app/controllers/comments_controller.rb +0 -36
- data/spec/rails_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails_app/app/controllers/spa_controller.rb +0 -7
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users_controller.rb +0 -26
- data/spec/rails_app/app/helpers/application_helper.rb +0 -2
- data/spec/rails_app/app/helpers/devise_helper.rb +0 -2
- data/spec/rails_app/app/javascript/App.vue +0 -40
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +0 -82
- data/spec/rails_app/app/javascript/components/Top.vue +0 -98
- data/spec/rails_app/app/javascript/components/notifications/Index.vue +0 -200
- data/spec/rails_app/app/javascript/components/notifications/Notification.vue +0 -133
- data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +0 -122
- data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +0 -279
- data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +0 -112
- data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +0 -141
- data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +0 -226
- data/spec/rails_app/app/javascript/config/development.js +0 -5
- data/spec/rails_app/app/javascript/config/environment.js +0 -7
- data/spec/rails_app/app/javascript/config/production.js +0 -5
- data/spec/rails_app/app/javascript/config/test.js +0 -5
- data/spec/rails_app/app/javascript/packs/application.js +0 -18
- data/spec/rails_app/app/javascript/packs/spa.js +0 -14
- data/spec/rails_app/app/javascript/router/index.js +0 -73
- data/spec/rails_app/app/javascript/store/index.js +0 -37
- data/spec/rails_app/app/mailers/.keep +0 -0
- data/spec/rails_app/app/mailers/custom_notification_mailer.rb +0 -5
- data/spec/rails_app/app/models/admin.rb +0 -35
- data/spec/rails_app/app/models/article.rb +0 -54
- data/spec/rails_app/app/models/comment.rb +0 -81
- data/spec/rails_app/app/models/dummy/dummy_base.rb +0 -11
- data/spec/rails_app/app/models/dummy/dummy_group.rb +0 -23
- data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +0 -15
- data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +0 -27
- data/spec/rails_app/app/models/dummy/dummy_notifier.rb +0 -15
- data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +0 -14
- data/spec/rails_app/app/models/dummy/dummy_target.rb +0 -16
- data/spec/rails_app/app/models/user.rb +0 -73
- data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +0 -146
- data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +0 -10
- data/spec/rails_app/app/views/articles/_form.html.erb +0 -24
- data/spec/rails_app/app/views/articles/edit.html.erb +0 -8
- data/spec/rails_app/app/views/articles/index.html.erb +0 -113
- data/spec/rails_app/app/views/articles/new.html.erb +0 -7
- data/spec/rails_app/app/views/articles/show.html.erb +0 -49
- data/spec/rails_app/app/views/layouts/_header.html.erb +0 -46
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -15
- data/spec/rails_app/app/views/spa/index.html.erb +0 -2
- data/spec/rails_app/babel.config.js +0 -72
- data/spec/rails_app/bin/bundle +0 -3
- data/spec/rails_app/bin/rails +0 -4
- data/spec/rails_app/bin/rake +0 -4
- data/spec/rails_app/bin/setup +0 -29
- data/spec/rails_app/bin/webpack +0 -18
- data/spec/rails_app/bin/webpack-dev-server +0 -18
- data/spec/rails_app/config/application.rb +0 -54
- data/spec/rails_app/config/boot.rb +0 -5
- data/spec/rails_app/config/cable.yml +0 -8
- data/spec/rails_app/config/database.yml +0 -36
- data/spec/rails_app/config/dynamoid.rb +0 -13
- data/spec/rails_app/config/environment.rb +0 -26
- data/spec/rails_app/config/environments/development.rb +0 -60
- data/spec/rails_app/config/environments/production.rb +0 -85
- data/spec/rails_app/config/environments/test.rb +0 -53
- data/spec/rails_app/config/initializers/activity_notification.rb +0 -104
- data/spec/rails_app/config/initializers/assets.rb +0 -11
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails_app/config/initializers/cookies_serializer.rb +0 -3
- data/spec/rails_app/config/initializers/copy_it.aws.rb.template +0 -6
- data/spec/rails_app/config/initializers/devise.rb +0 -278
- data/spec/rails_app/config/initializers/devise_token_auth.rb +0 -55
- data/spec/rails_app/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/rails_app/config/initializers/inflections.rb +0 -16
- data/spec/rails_app/config/initializers/mime_types.rb +0 -4
- data/spec/rails_app/config/initializers/mysql.rb +0 -9
- data/spec/rails_app/config/initializers/session_store.rb +0 -3
- data/spec/rails_app/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails_app/config/initializers/zeitwerk.rb +0 -10
- data/spec/rails_app/config/locales/activity_notification.en.yml +0 -26
- data/spec/rails_app/config/locales/devise.en.yml +0 -62
- data/spec/rails_app/config/mongoid.yml +0 -13
- data/spec/rails_app/config/routes.rb +0 -50
- data/spec/rails_app/config/secrets.yml +0 -22
- data/spec/rails_app/config/webpack/development.js +0 -5
- data/spec/rails_app/config/webpack/environment.js +0 -7
- data/spec/rails_app/config/webpack/loaders/vue.js +0 -6
- data/spec/rails_app/config/webpack/production.js +0 -5
- data/spec/rails_app/config/webpack/test.js +0 -5
- data/spec/rails_app/config/webpacker.yml +0 -97
- data/spec/rails_app/config.ru +0 -4
- data/spec/rails_app/db/migrate/20160716000000_create_test_tables.rb +0 -42
- data/spec/rails_app/db/migrate/20181209000000_create_activity_notification_tables.rb +0 -33
- data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +0 -10
- data/spec/rails_app/db/schema.rb +0 -98
- data/spec/rails_app/db/seeds.rb +0 -95
- data/spec/rails_app/lib/custom_optional_targets/console_output.rb +0 -16
- data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +0 -14
- data/spec/rails_app/lib/custom_optional_targets/wrong_target.rb +0 -13
- data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +0 -29
- data/spec/rails_app/package.json +0 -23
- data/spec/rails_app/postcss.config.js +0 -12
- data/spec/rails_app/public/404.html +0 -67
- data/spec/rails_app/public/422.html +0 -67
- data/spec/rails_app/public/500.html +0 -66
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/roles/acts_as_group_spec.rb +0 -30
- data/spec/roles/acts_as_notifiable_spec.rb +0 -432
- data/spec/roles/acts_as_notifier_spec.rb +0 -30
- data/spec/roles/acts_as_target_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -56
- data/spec/version_spec.rb +0 -31
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
|
2
|
-
|
|
3
|
-
default: &default
|
|
4
|
-
source_path: app/javascript
|
|
5
|
-
source_entry_path: packs
|
|
6
|
-
public_root_path: public
|
|
7
|
-
public_output_path: packs
|
|
8
|
-
cache_path: tmp/cache/webpacker
|
|
9
|
-
check_yarn_integrity: false
|
|
10
|
-
webpack_compile_output: true
|
|
11
|
-
|
|
12
|
-
# Additional paths webpack should lookup modules
|
|
13
|
-
# ['app/assets', 'engine/foo/app/assets']
|
|
14
|
-
resolved_paths: []
|
|
15
|
-
|
|
16
|
-
# Reload manifest.json on all requests so we reload latest compiled packs
|
|
17
|
-
cache_manifest: false
|
|
18
|
-
|
|
19
|
-
# Extract and emit a css file
|
|
20
|
-
extract_css: false
|
|
21
|
-
|
|
22
|
-
static_assets_extensions:
|
|
23
|
-
- .jpg
|
|
24
|
-
- .jpeg
|
|
25
|
-
- .png
|
|
26
|
-
- .gif
|
|
27
|
-
- .tiff
|
|
28
|
-
- .ico
|
|
29
|
-
- .svg
|
|
30
|
-
- .eot
|
|
31
|
-
- .otf
|
|
32
|
-
- .ttf
|
|
33
|
-
- .woff
|
|
34
|
-
- .woff2
|
|
35
|
-
|
|
36
|
-
extensions:
|
|
37
|
-
- .vue
|
|
38
|
-
- .mjs
|
|
39
|
-
- .js
|
|
40
|
-
- .sass
|
|
41
|
-
- .scss
|
|
42
|
-
- .css
|
|
43
|
-
- .module.sass
|
|
44
|
-
- .module.scss
|
|
45
|
-
- .module.css
|
|
46
|
-
- .png
|
|
47
|
-
- .svg
|
|
48
|
-
- .gif
|
|
49
|
-
- .jpeg
|
|
50
|
-
- .jpg
|
|
51
|
-
|
|
52
|
-
development:
|
|
53
|
-
<<: *default
|
|
54
|
-
compile: true
|
|
55
|
-
|
|
56
|
-
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
|
|
57
|
-
check_yarn_integrity: true
|
|
58
|
-
|
|
59
|
-
# Reference: https://webpack.js.org/configuration/dev-server/
|
|
60
|
-
dev_server:
|
|
61
|
-
https: false
|
|
62
|
-
host: localhost
|
|
63
|
-
port: 3035
|
|
64
|
-
public: localhost:3035
|
|
65
|
-
hmr: false
|
|
66
|
-
# Inline should be set to true if using HMR
|
|
67
|
-
inline: true
|
|
68
|
-
overlay: true
|
|
69
|
-
compress: true
|
|
70
|
-
disable_host_check: true
|
|
71
|
-
use_local_ip: false
|
|
72
|
-
quiet: false
|
|
73
|
-
pretty: false
|
|
74
|
-
headers:
|
|
75
|
-
'Access-Control-Allow-Origin': '*'
|
|
76
|
-
watch_options:
|
|
77
|
-
ignored: '**/node_modules/**'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
test:
|
|
81
|
-
<<: *default
|
|
82
|
-
compile: true
|
|
83
|
-
|
|
84
|
-
# Compile test packs to a separate directory
|
|
85
|
-
public_output_path: packs-test
|
|
86
|
-
|
|
87
|
-
production:
|
|
88
|
-
<<: *default
|
|
89
|
-
|
|
90
|
-
# Production depends on precompilation of packs prior to booting for performance.
|
|
91
|
-
compile: false
|
|
92
|
-
|
|
93
|
-
# Extract and emit a css file
|
|
94
|
-
extract_css: false
|
|
95
|
-
|
|
96
|
-
# Cache manifest.json for performance
|
|
97
|
-
cache_manifest: true
|
data/spec/rails_app/config.ru
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
class CreateTestTables < ActiveRecord::Migration[5.2]
|
|
2
|
-
def change
|
|
3
|
-
create_table :users do |t|
|
|
4
|
-
# Devise
|
|
5
|
-
## Database authenticatable
|
|
6
|
-
t.string :email, null: false, default: "", index: true, unique: true
|
|
7
|
-
t.string :encrypted_password, null: false, default: ""
|
|
8
|
-
## Confirmable
|
|
9
|
-
t.string :confirmation_token
|
|
10
|
-
t.datetime :confirmed_at
|
|
11
|
-
t.datetime :confirmation_sent_at
|
|
12
|
-
# Apps
|
|
13
|
-
t.string :name
|
|
14
|
-
|
|
15
|
-
t.timestamps
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
create_table :admins do |t|
|
|
19
|
-
t.references :user, index: true
|
|
20
|
-
t.string :phone_number
|
|
21
|
-
t.string :slack_username
|
|
22
|
-
|
|
23
|
-
t.timestamps
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
create_table :articles do |t|
|
|
27
|
-
t.references :user, index: true
|
|
28
|
-
t.string :title
|
|
29
|
-
t.string :body
|
|
30
|
-
|
|
31
|
-
t.timestamps
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
create_table :comments do |t|
|
|
35
|
-
t.references :user, index: true
|
|
36
|
-
t.references :article, index: true
|
|
37
|
-
t.string :body
|
|
38
|
-
|
|
39
|
-
t.timestamps
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Migration responsible for creating a table with notifications
|
|
2
|
-
class CreateActivityNotificationTables < ActiveRecord::Migration[5.2]
|
|
3
|
-
# Create tables
|
|
4
|
-
def change
|
|
5
|
-
create_table :notifications do |t|
|
|
6
|
-
t.belongs_to :target, polymorphic: true, index: true, null: false
|
|
7
|
-
t.belongs_to :notifiable, polymorphic: true, index: true, null: false
|
|
8
|
-
t.string :key, null: false
|
|
9
|
-
t.belongs_to :group, polymorphic: true, index: true
|
|
10
|
-
t.integer :group_owner_id, index: true
|
|
11
|
-
t.belongs_to :notifier, polymorphic: true, index: true
|
|
12
|
-
t.text :parameters
|
|
13
|
-
t.datetime :opened_at
|
|
14
|
-
|
|
15
|
-
t.timestamps null: false
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
create_table :subscriptions do |t|
|
|
19
|
-
t.belongs_to :target, polymorphic: true, index: true, null: false
|
|
20
|
-
t.string :key, index: true, null: false
|
|
21
|
-
t.boolean :subscribing, null: false, default: true
|
|
22
|
-
t.boolean :subscribing_to_email, null: false, default: true
|
|
23
|
-
t.datetime :subscribed_at
|
|
24
|
-
t.datetime :unsubscribed_at
|
|
25
|
-
t.datetime :subscribed_to_email_at
|
|
26
|
-
t.datetime :unsubscribed_to_email_at
|
|
27
|
-
t.text :optional_targets
|
|
28
|
-
|
|
29
|
-
t.timestamps null: false
|
|
30
|
-
end
|
|
31
|
-
add_index :subscriptions, [:target_type, :target_id, :key], unique: true
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
class AddTokensToUsers < ActiveRecord::Migration[5.2]
|
|
2
|
-
def change
|
|
3
|
-
## Required
|
|
4
|
-
add_column :users, :provider, :string, null: false, default: "email"
|
|
5
|
-
add_column :users, :uid, :string, null: false, default: ""
|
|
6
|
-
|
|
7
|
-
## Tokens
|
|
8
|
-
add_column :users, :tokens, :text
|
|
9
|
-
end
|
|
10
|
-
end
|
data/spec/rails_app/db/schema.rb
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
-
#
|
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
|
6
|
-
# database schema. If you need to create the application database on another
|
|
7
|
-
# system, you should be using db:schema:load, not running all the migrations
|
|
8
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
|
9
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
|
10
|
-
#
|
|
11
|
-
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
-
|
|
13
|
-
ActiveRecord::Schema.define(version: 2019_12_01_000000) do
|
|
14
|
-
|
|
15
|
-
create_table "admins", force: :cascade do |t|
|
|
16
|
-
t.integer "user_id"
|
|
17
|
-
t.string "phone_number"
|
|
18
|
-
t.string "slack_username"
|
|
19
|
-
t.datetime "created_at", null: false
|
|
20
|
-
t.datetime "updated_at", null: false
|
|
21
|
-
t.index ["user_id"], name: "index_admins_on_user_id"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
create_table "articles", force: :cascade do |t|
|
|
25
|
-
t.integer "user_id"
|
|
26
|
-
t.string "title"
|
|
27
|
-
t.string "body"
|
|
28
|
-
t.datetime "created_at", null: false
|
|
29
|
-
t.datetime "updated_at", null: false
|
|
30
|
-
t.index ["user_id"], name: "index_articles_on_user_id"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
create_table "comments", force: :cascade do |t|
|
|
34
|
-
t.integer "user_id"
|
|
35
|
-
t.integer "article_id"
|
|
36
|
-
t.string "body"
|
|
37
|
-
t.datetime "created_at", null: false
|
|
38
|
-
t.datetime "updated_at", null: false
|
|
39
|
-
t.index ["article_id"], name: "index_comments_on_article_id"
|
|
40
|
-
t.index ["user_id"], name: "index_comments_on_user_id"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
create_table "notifications", force: :cascade do |t|
|
|
44
|
-
t.string "target_type", null: false
|
|
45
|
-
t.integer "target_id", null: false
|
|
46
|
-
t.string "notifiable_type", null: false
|
|
47
|
-
t.integer "notifiable_id", null: false
|
|
48
|
-
t.string "key", null: false
|
|
49
|
-
t.string "group_type"
|
|
50
|
-
t.integer "group_id"
|
|
51
|
-
t.integer "group_owner_id"
|
|
52
|
-
t.string "notifier_type"
|
|
53
|
-
t.integer "notifier_id"
|
|
54
|
-
t.text "parameters"
|
|
55
|
-
t.datetime "opened_at"
|
|
56
|
-
t.datetime "created_at", null: false
|
|
57
|
-
t.datetime "updated_at", null: false
|
|
58
|
-
t.index ["group_owner_id"], name: "index_notifications_on_group_owner_id"
|
|
59
|
-
t.index ["group_type", "group_id"], name: "index_notifications_on_group_type_and_group_id"
|
|
60
|
-
t.index ["notifiable_type", "notifiable_id"], name: "index_notifications_on_notifiable_type_and_notifiable_id"
|
|
61
|
-
t.index ["notifier_type", "notifier_id"], name: "index_notifications_on_notifier_type_and_notifier_id"
|
|
62
|
-
t.index ["target_type", "target_id"], name: "index_notifications_on_target_type_and_target_id"
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
create_table "subscriptions", force: :cascade do |t|
|
|
66
|
-
t.string "target_type", null: false
|
|
67
|
-
t.integer "target_id", null: false
|
|
68
|
-
t.string "key", null: false
|
|
69
|
-
t.boolean "subscribing", default: true, null: false
|
|
70
|
-
t.boolean "subscribing_to_email", default: true, null: false
|
|
71
|
-
t.datetime "subscribed_at"
|
|
72
|
-
t.datetime "unsubscribed_at"
|
|
73
|
-
t.datetime "subscribed_to_email_at"
|
|
74
|
-
t.datetime "unsubscribed_to_email_at"
|
|
75
|
-
t.text "optional_targets"
|
|
76
|
-
t.datetime "created_at", null: false
|
|
77
|
-
t.datetime "updated_at", null: false
|
|
78
|
-
t.index ["key"], name: "index_subscriptions_on_key"
|
|
79
|
-
t.index ["target_type", "target_id", "key"], name: "index_subscriptions_on_target_type_and_target_id_and_key", unique: true
|
|
80
|
-
t.index ["target_type", "target_id"], name: "index_subscriptions_on_target_type_and_target_id"
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
create_table "users", force: :cascade do |t|
|
|
84
|
-
t.string "email", default: "", null: false
|
|
85
|
-
t.string "encrypted_password", default: "", null: false
|
|
86
|
-
t.string "confirmation_token"
|
|
87
|
-
t.datetime "confirmed_at"
|
|
88
|
-
t.datetime "confirmation_sent_at"
|
|
89
|
-
t.string "name"
|
|
90
|
-
t.datetime "created_at", null: false
|
|
91
|
-
t.datetime "updated_at", null: false
|
|
92
|
-
t.string "provider", default: "email", null: false
|
|
93
|
-
t.string "uid", default: "", null: false
|
|
94
|
-
t.text "tokens"
|
|
95
|
-
t.index ["email"], name: "index_users_on_email"
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
end
|
data/spec/rails_app/db/seeds.rb
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
# This file is seed file for test data on development environment.
|
|
3
|
-
|
|
4
|
-
def clean_database
|
|
5
|
-
models = [Comment, Article, Admin, User]
|
|
6
|
-
if ENV['AN_USE_EXISTING_DYNAMODB_TABLE']
|
|
7
|
-
ActivityNotification::Notification.where('id.not_null': true).delete_all
|
|
8
|
-
ActivityNotification::Subscription.where('id.not_null': true).delete_all
|
|
9
|
-
else
|
|
10
|
-
models.concat([ActivityNotification::Notification, ActivityNotification::Subscription])
|
|
11
|
-
end
|
|
12
|
-
models.each do |model|
|
|
13
|
-
model.delete_all
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def reset_pk_sequence
|
|
18
|
-
models = [Comment, Article, Admin, User]
|
|
19
|
-
if ActivityNotification.config.orm == :active_record
|
|
20
|
-
models.concat([ActivityNotification::Notification, ActivityNotification::Subscription])
|
|
21
|
-
end
|
|
22
|
-
case ENV['AN_TEST_DB']
|
|
23
|
-
when nil, '', 'sqlite'
|
|
24
|
-
ActiveRecord::Base.connection.execute("UPDATE sqlite_sequence SET seq = 0")
|
|
25
|
-
when 'mysql'
|
|
26
|
-
models.each do |model|
|
|
27
|
-
ActiveRecord::Base.connection.execute("ALTER TABLE #{model.table_name} AUTO_INCREMENT = 1")
|
|
28
|
-
end
|
|
29
|
-
when 'postgresql'
|
|
30
|
-
models.each do |model|
|
|
31
|
-
ActiveRecord::Base.connection.reset_pk_sequence!(model.table_name)
|
|
32
|
-
end
|
|
33
|
-
when 'mongodb'
|
|
34
|
-
else
|
|
35
|
-
raise "#{ENV['AN_TEST_DB']} as AN_TEST_DB environment variable is not supported"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
clean_database
|
|
40
|
-
puts "* Cleaned database"
|
|
41
|
-
|
|
42
|
-
reset_pk_sequence
|
|
43
|
-
puts "* Reset sequences for primary keys"
|
|
44
|
-
|
|
45
|
-
['Ichiro', 'Stephen', 'Klay', 'Kevin'].each do |name|
|
|
46
|
-
user = User.new(
|
|
47
|
-
email: "#{name.downcase}@example.com",
|
|
48
|
-
password: 'changeit',
|
|
49
|
-
password_confirmation: 'changeit',
|
|
50
|
-
name: name,
|
|
51
|
-
)
|
|
52
|
-
user.skip_confirmation!
|
|
53
|
-
user.save!
|
|
54
|
-
end
|
|
55
|
-
puts "* Created #{User.count} user records"
|
|
56
|
-
|
|
57
|
-
['Ichiro'].each do |name|
|
|
58
|
-
user = User.find_by(name: name)
|
|
59
|
-
Admin.create(
|
|
60
|
-
user: user,
|
|
61
|
-
phone_number: ENV['OPTIONAL_TARGET_AMAZON_SNS_PHONE_NUMBER'],
|
|
62
|
-
slack_username: ENV['OPTIONAL_TARGET_SLACK_USERNAME']
|
|
63
|
-
)
|
|
64
|
-
end
|
|
65
|
-
puts "* Created #{Admin.count} admin records"
|
|
66
|
-
|
|
67
|
-
User.all.each do |user|
|
|
68
|
-
article = user.articles.create(
|
|
69
|
-
title: "#{user.name}'s first article",
|
|
70
|
-
body: "This is the first #{user.name}'s article. Please read it!"
|
|
71
|
-
)
|
|
72
|
-
article.notify :users, send_email: false
|
|
73
|
-
end
|
|
74
|
-
puts "* Created #{Article.count} article records"
|
|
75
|
-
notifications = ActivityNotification::Notification.filtered_by_type("Article")
|
|
76
|
-
puts "** Generated #{ActivityNotification::Notification.filtered_by_type("Article").count} notification records for new articles"
|
|
77
|
-
puts "*** #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("User").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("User").group_owners_only.count} groups to users"
|
|
78
|
-
puts "*** #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("Admin").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Article").filtered_by_target_type("Admin").group_owners_only.count} groups to admins"
|
|
79
|
-
|
|
80
|
-
Article.all.each do |article|
|
|
81
|
-
User.all.each do |user|
|
|
82
|
-
comment = article.comments.create(
|
|
83
|
-
user: user,
|
|
84
|
-
body: "This is the first #{user.name}'s comment to #{article.user.name}'s article."
|
|
85
|
-
)
|
|
86
|
-
comment.notify :users, send_email: false
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
puts "* Created #{Comment.count} comment records"
|
|
90
|
-
notifications = ActivityNotification::Notification.filtered_by_type("Comment")
|
|
91
|
-
puts "** Generated #{ActivityNotification::Notification.filtered_by_type("Comment").count} notification records for new comments"
|
|
92
|
-
puts "*** #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("User").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("User").group_owners_only.count} groups to users"
|
|
93
|
-
puts "*** #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("Admin").count} notifications as #{ActivityNotification::Notification.filtered_by_type("Comment").filtered_by_target_type("Admin").group_owners_only.count} groups to admins"
|
|
94
|
-
|
|
95
|
-
puts "Created ActivityNotification test records!"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module CustomOptionalTarget
|
|
2
|
-
# Optional target implementation to output console.
|
|
3
|
-
class ConsoleOutput < ActivityNotification::OptionalTarget::Base
|
|
4
|
-
def initialize_target(options = {})
|
|
5
|
-
@console_out = options[:console_out] == false ? false : true
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def notify(notification, options = {})
|
|
9
|
-
if @console_out
|
|
10
|
-
puts "----- Optional targets: #{self.class.name} -----"
|
|
11
|
-
puts render_notification_message(notification, options)
|
|
12
|
-
puts "-----------------------------------------------------------------"
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module CustomOptionalTarget
|
|
2
|
-
# Optional target implementation to raise error.
|
|
3
|
-
class RaiseError < ActivityNotification::OptionalTarget::Base
|
|
4
|
-
def initialize_target(options = {})
|
|
5
|
-
@raise_error = options[:raise_error] == false ? false : true
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def notify(notification, options = {})
|
|
9
|
-
if @raise_error
|
|
10
|
-
raise 'Intentional RuntimeError in CustomOptionalTarget::RaiseError'
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
class ActivityNotification::MailerPreview < ActionMailer::Preview
|
|
2
|
-
|
|
3
|
-
def send_notification_email_single
|
|
4
|
-
target_notification =
|
|
5
|
-
case ActivityNotification.config.orm
|
|
6
|
-
when :active_record then ActivityNotification::Notification.where(group: nil).first
|
|
7
|
-
when :mongoid then ActivityNotification::Notification.where(group: nil).first
|
|
8
|
-
when :dynamoid then ActivityNotification::Notification.where('group_key.null': true).first
|
|
9
|
-
end
|
|
10
|
-
ActivityNotification::Mailer.send_notification_email(target_notification)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def send_notification_email_with_group
|
|
14
|
-
target_notification =
|
|
15
|
-
case ActivityNotification.config.orm
|
|
16
|
-
when :active_record then ActivityNotification::Notification.where.not(group: nil).first
|
|
17
|
-
when :mongoid then ActivityNotification::Notification.where(:group_id.nin => ["", nil]).first
|
|
18
|
-
when :dynamoid then ActivityNotification::Notification.where('group_key.not_null': true).first
|
|
19
|
-
end
|
|
20
|
-
ActivityNotification::Mailer.send_notification_email(target_notification)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def send_batch_notification_email
|
|
24
|
-
target = User.find_by(name: 'Ichiro')
|
|
25
|
-
target_notifications = target.notification_index_with_attributes(filtered_by_key: 'comment.default')
|
|
26
|
-
ActivityNotification::Mailer.send_batch_notification_email(target, target_notifications, 'batch.comment.default')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
data/spec/rails_app/package.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "activity_notification",
|
|
3
|
-
"description": "Sample single page application for activity_notification using Vue.js",
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"@rails/webpacker": ">=4.3.0",
|
|
6
|
-
"axios": ">=0.21.1",
|
|
7
|
-
"vue": ">=2.6.10",
|
|
8
|
-
"vuex": ">=3.1.2",
|
|
9
|
-
"vuex-persistedstate": ">=2.7.0",
|
|
10
|
-
"vue-loader": ">=15.7.2",
|
|
11
|
-
"vue-router": ">=3.1.3",
|
|
12
|
-
"vue-template-compiler": ">=2.6.10",
|
|
13
|
-
"vue-moment": ">=4.1.0",
|
|
14
|
-
"vue-moment-tz": ">=2.1.1",
|
|
15
|
-
"vue-pluralize": ">=0.0.2",
|
|
16
|
-
"actioncable-vue": ">=1.5.1",
|
|
17
|
-
"push.js": ">=1.0.12"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"webpack-dev-server": ">=3.11.0"
|
|
21
|
-
},
|
|
22
|
-
"license": "MIT"
|
|
23
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<style>
|
|
7
|
-
body {
|
|
8
|
-
background-color: #EFEFEF;
|
|
9
|
-
color: #2E2F30;
|
|
10
|
-
text-align: center;
|
|
11
|
-
font-family: arial, sans-serif;
|
|
12
|
-
margin: 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
div.dialog {
|
|
16
|
-
width: 95%;
|
|
17
|
-
max-width: 33em;
|
|
18
|
-
margin: 4em auto 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
div.dialog > div {
|
|
22
|
-
border: 1px solid #CCC;
|
|
23
|
-
border-right-color: #999;
|
|
24
|
-
border-left-color: #999;
|
|
25
|
-
border-bottom-color: #BBB;
|
|
26
|
-
border-top: #B00100 solid 4px;
|
|
27
|
-
border-top-left-radius: 9px;
|
|
28
|
-
border-top-right-radius: 9px;
|
|
29
|
-
background-color: white;
|
|
30
|
-
padding: 7px 12% 0;
|
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
h1 {
|
|
35
|
-
font-size: 100%;
|
|
36
|
-
color: #730E15;
|
|
37
|
-
line-height: 1.5em;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
div.dialog > p {
|
|
41
|
-
margin: 0 0 1em;
|
|
42
|
-
padding: 1em;
|
|
43
|
-
background-color: #F7F7F7;
|
|
44
|
-
border: 1px solid #CCC;
|
|
45
|
-
border-right-color: #999;
|
|
46
|
-
border-left-color: #999;
|
|
47
|
-
border-bottom-color: #999;
|
|
48
|
-
border-bottom-left-radius: 4px;
|
|
49
|
-
border-bottom-right-radius: 4px;
|
|
50
|
-
border-top-color: #DADADA;
|
|
51
|
-
color: #666;
|
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
-
}
|
|
54
|
-
</style>
|
|
55
|
-
</head>
|
|
56
|
-
|
|
57
|
-
<body>
|
|
58
|
-
<!-- This file lives in public/404.html -->
|
|
59
|
-
<div class="dialog">
|
|
60
|
-
<div>
|
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
|
63
|
-
</div>
|
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
-
</div>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<style>
|
|
7
|
-
body {
|
|
8
|
-
background-color: #EFEFEF;
|
|
9
|
-
color: #2E2F30;
|
|
10
|
-
text-align: center;
|
|
11
|
-
font-family: arial, sans-serif;
|
|
12
|
-
margin: 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
div.dialog {
|
|
16
|
-
width: 95%;
|
|
17
|
-
max-width: 33em;
|
|
18
|
-
margin: 4em auto 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
div.dialog > div {
|
|
22
|
-
border: 1px solid #CCC;
|
|
23
|
-
border-right-color: #999;
|
|
24
|
-
border-left-color: #999;
|
|
25
|
-
border-bottom-color: #BBB;
|
|
26
|
-
border-top: #B00100 solid 4px;
|
|
27
|
-
border-top-left-radius: 9px;
|
|
28
|
-
border-top-right-radius: 9px;
|
|
29
|
-
background-color: white;
|
|
30
|
-
padding: 7px 12% 0;
|
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
h1 {
|
|
35
|
-
font-size: 100%;
|
|
36
|
-
color: #730E15;
|
|
37
|
-
line-height: 1.5em;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
div.dialog > p {
|
|
41
|
-
margin: 0 0 1em;
|
|
42
|
-
padding: 1em;
|
|
43
|
-
background-color: #F7F7F7;
|
|
44
|
-
border: 1px solid #CCC;
|
|
45
|
-
border-right-color: #999;
|
|
46
|
-
border-left-color: #999;
|
|
47
|
-
border-bottom-color: #999;
|
|
48
|
-
border-bottom-left-radius: 4px;
|
|
49
|
-
border-bottom-right-radius: 4px;
|
|
50
|
-
border-top-color: #DADADA;
|
|
51
|
-
color: #666;
|
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
-
}
|
|
54
|
-
</style>
|
|
55
|
-
</head>
|
|
56
|
-
|
|
57
|
-
<body>
|
|
58
|
-
<!-- This file lives in public/422.html -->
|
|
59
|
-
<div class="dialog">
|
|
60
|
-
<div>
|
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
63
|
-
</div>
|
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
-
</div>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|