activity_notification 1.4.4 → 2.2.4
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 +5 -5
- data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- data/.github/pull_request_template.md +13 -0
- data/.github/workflows/build.yml +116 -0
- data/.gitignore +15 -3
- data/CHANGELOG.md +200 -1
- data/Gemfile +17 -2
- data/Procfile +2 -0
- data/README.md +168 -1033
- data/Rakefile +19 -10
- data/activity_notification.gemspec +14 -9
- data/app/channels/activity_notification/notification_api_channel.rb +12 -0
- data/app/channels/activity_notification/notification_api_with_devise_channel.rb +46 -0
- data/app/channels/activity_notification/notification_channel.rb +37 -0
- data/app/channels/activity_notification/notification_with_devise_channel.rb +51 -0
- data/app/controllers/activity_notification/apidocs_controller.rb +75 -0
- data/app/controllers/activity_notification/notifications_api_controller.rb +143 -0
- data/app/controllers/activity_notification/notifications_api_with_devise_controller.rb +7 -0
- data/app/controllers/activity_notification/notifications_controller.rb +60 -54
- data/app/controllers/activity_notification/subscriptions_api_controller.rb +197 -0
- data/app/controllers/activity_notification/subscriptions_api_with_devise_controller.rb +7 -0
- data/app/controllers/activity_notification/subscriptions_controller.rb +83 -73
- data/app/jobs/activity_notification/notify_all_job.rb +25 -0
- data/app/jobs/activity_notification/notify_job.rb +26 -0
- data/app/jobs/activity_notification/notify_to_job.rb +25 -0
- data/app/views/activity_notification/notifications/default/_default.html.erb +23 -23
- data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb +19 -19
- data/app/views/activity_notification/notifications/default/_index.html.erb +3 -3
- data/app/views/activity_notification/notifications/default/index.html.erb +60 -7
- data/app/views/activity_notification/notifications/default/open.js.erb +2 -2
- data/app/views/activity_notification/notifications/default/open_all.js.erb +2 -2
- data/app/views/activity_notification/notifications/default/show.html.erb +2 -2
- data/app/views/activity_notification/optional_targets/default/action_cable_channel/_default.html.erb +176 -0
- data/app/views/activity_notification/optional_targets/default/base/_default.text.erb +1 -1
- data/app/views/activity_notification/optional_targets/default/slack/_default.text.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/_form.html.erb +2 -2
- data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +5 -33
- data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +8 -8
- data/app/views/activity_notification/subscriptions/default/index.html.erb +13 -9
- data/app/views/activity_notification/subscriptions/default/show.html.erb +3 -3
- data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/subscribe_to_optional_target.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/unsubscribe_to_optional_target.js.erb +1 -1
- data/bin/_dynamodblocal +4 -0
- data/bin/bundle_update.sh +7 -0
- data/bin/deploy_on_heroku.sh +16 -0
- data/bin/install_dynamodblocal.sh +5 -0
- data/bin/start_dynamodblocal.sh +47 -0
- data/bin/stop_dynamodblocal.sh +34 -0
- data/docs/CODE_OF_CONDUCT.md +76 -0
- data/docs/CONTRIBUTING.md +36 -0
- data/docs/Functions.md +1146 -0
- data/docs/Setup.md +817 -0
- data/docs/Testing.md +148 -0
- data/gemfiles/Gemfile.rails-5.0 +8 -1
- data/gemfiles/Gemfile.rails-5.1 +7 -1
- data/gemfiles/Gemfile.rails-5.2 +24 -0
- data/gemfiles/Gemfile.rails-6.0 +23 -0
- data/gemfiles/Gemfile.rails-6.1 +22 -0
- data/gemfiles/Gemfile.rails-7.0 +25 -0
- data/lib/activity_notification/apis/notification_api.rb +356 -159
- data/lib/activity_notification/apis/subscription_api.rb +98 -59
- data/lib/activity_notification/apis/swagger.rb +6 -0
- data/lib/activity_notification/common.rb +18 -7
- data/lib/activity_notification/config.rb +176 -30
- data/lib/activity_notification/controllers/common_api_controller.rb +30 -0
- data/lib/activity_notification/controllers/common_controller.rb +47 -27
- data/lib/activity_notification/controllers/concerns/swagger/error_responses.rb +55 -0
- data/lib/activity_notification/controllers/concerns/swagger/notifications_api.rb +273 -0
- data/lib/activity_notification/controllers/concerns/swagger/notifications_parameters.rb +92 -0
- data/lib/activity_notification/controllers/concerns/swagger/subscriptions_api.rb +405 -0
- data/lib/activity_notification/controllers/concerns/swagger/subscriptions_parameters.rb +50 -0
- data/lib/activity_notification/controllers/devise_authentication_controller.rb +22 -5
- data/lib/activity_notification/gem_version.rb +14 -0
- data/lib/activity_notification/helpers/errors.rb +6 -0
- data/lib/activity_notification/helpers/view_helpers.rb +118 -28
- data/lib/activity_notification/mailers/helpers.rb +19 -12
- data/lib/activity_notification/models/concerns/notifiable.rb +142 -55
- data/lib/activity_notification/models/concerns/subscriber.rb +28 -13
- data/lib/activity_notification/models/concerns/swagger/error_schema.rb +36 -0
- data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +209 -0
- data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +162 -0
- data/lib/activity_notification/models/concerns/target.rb +131 -32
- data/lib/activity_notification/models/notification.rb +1 -0
- data/lib/activity_notification/models/subscription.rb +1 -0
- data/lib/activity_notification/models.rb +23 -1
- data/lib/activity_notification/optional_targets/action_cable_api_channel.rb +69 -0
- data/lib/activity_notification/optional_targets/action_cable_channel.rb +68 -0
- data/lib/activity_notification/optional_targets/base.rb +9 -15
- data/lib/activity_notification/orm/active_record/notification.rb +23 -34
- data/lib/activity_notification/orm/active_record/subscription.rb +1 -1
- data/lib/activity_notification/orm/active_record.rb +1 -1
- data/lib/activity_notification/orm/dynamoid/extension.rb +262 -0
- data/lib/activity_notification/orm/dynamoid/notification.rb +224 -0
- data/lib/activity_notification/orm/dynamoid/subscription.rb +82 -0
- data/lib/activity_notification/orm/dynamoid.rb +530 -0
- data/lib/activity_notification/orm/mongoid/notification.rb +29 -28
- data/lib/activity_notification/orm/mongoid/subscription.rb +3 -3
- data/lib/activity_notification/orm/mongoid.rb +33 -1
- data/lib/activity_notification/rails/routes.rb +273 -60
- data/lib/activity_notification/renderable.rb +22 -7
- data/lib/activity_notification/roles/acts_as_notifiable.rb +64 -1
- data/lib/activity_notification/roles/acts_as_target.rb +99 -9
- data/lib/activity_notification/version.rb +1 -1
- data/lib/activity_notification.rb +14 -0
- data/lib/generators/activity_notification/controllers_generator.rb +2 -1
- data/lib/generators/templates/activity_notification.rb +61 -7
- data/lib/generators/templates/controllers/README +2 -2
- data/lib/generators/templates/controllers/notifications_api_controller.rb +31 -0
- data/lib/generators/templates/controllers/notifications_api_with_devise_controller.rb +31 -0
- data/lib/generators/templates/controllers/notifications_controller.rb +1 -37
- data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +1 -45
- data/lib/generators/templates/controllers/subscriptions_api_controller.rb +61 -0
- data/lib/generators/templates/controllers/subscriptions_api_with_devise_controller.rb +61 -0
- data/lib/generators/templates/controllers/subscriptions_controller.rb +14 -37
- data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +14 -45
- data/lib/generators/templates/migrations/migration.rb +5 -5
- data/lib/generators/templates/models/README +8 -4
- data/lib/generators/templates/models/notification.rb +1 -1
- data/lib/generators/templates/models/subscription.rb +1 -1
- data/lib/tasks/activity_notification_tasks.rake +14 -4
- data/package.json +8 -0
- data/spec/channels/notification_api_channel_shared_examples.rb +59 -0
- data/spec/channels/notification_api_channel_spec.rb +49 -0
- data/spec/channels/notification_api_with_devise_channel_spec.rb +76 -0
- data/spec/channels/notification_channel_shared_examples.rb +59 -0
- data/spec/channels/notification_channel_spec.rb +48 -0
- data/spec/channels/notification_with_devise_channel_spec.rb +97 -0
- data/spec/concerns/apis/notification_api_spec.rb +177 -12
- data/spec/concerns/apis/subscription_api_spec.rb +146 -4
- data/spec/concerns/common_spec.rb +25 -3
- data/spec/concerns/models/notifiable_spec.rb +161 -11
- data/spec/concerns/models/subscriber_spec.rb +253 -79
- data/spec/concerns/models/target_spec.rb +180 -47
- data/spec/concerns/renderable_spec.rb +35 -16
- data/spec/config_spec.rb +52 -1
- data/spec/controllers/controller_spec_utility.rb +100 -0
- data/spec/controllers/notifications_api_controller_shared_examples.rb +506 -0
- data/spec/controllers/notifications_api_controller_spec.rb +19 -0
- data/spec/controllers/notifications_api_with_devise_controller_spec.rb +60 -0
- data/spec/controllers/notifications_controller_shared_examples.rb +55 -76
- data/spec/controllers/notifications_controller_spec.rb +1 -2
- data/spec/controllers/notifications_with_devise_controller_spec.rb +14 -8
- data/spec/controllers/subscriptions_api_controller_shared_examples.rb +750 -0
- data/spec/controllers/subscriptions_api_controller_spec.rb +19 -0
- data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +60 -0
- data/spec/controllers/subscriptions_controller_shared_examples.rb +99 -121
- data/spec/controllers/subscriptions_controller_spec.rb +1 -2
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +14 -8
- data/spec/factories/notifications.rb +1 -1
- data/spec/factories/subscriptions.rb +3 -3
- data/spec/factories/users.rb +3 -3
- data/spec/generators/migration/migration_generator_spec.rb +29 -4
- data/spec/helpers/view_helpers_spec.rb +31 -21
- data/spec/jobs/notify_all_job_spec.rb +23 -0
- data/spec/jobs/notify_job_spec.rb +23 -0
- data/spec/jobs/notify_to_job_spec.rb +23 -0
- data/spec/mailers/mailer_spec.rb +42 -1
- data/spec/models/dummy/dummy_group_spec.rb +4 -0
- data/spec/models/dummy/dummy_notifiable_spec.rb +4 -0
- data/spec/models/dummy/dummy_notifier_spec.rb +4 -0
- data/spec/models/dummy/dummy_subscriber_spec.rb +3 -0
- data/spec/models/dummy/dummy_target_spec.rb +4 -0
- data/spec/models/notification_spec.rb +181 -45
- data/spec/models/subscription_spec.rb +77 -27
- data/spec/optional_targets/action_cable_api_channel_spec.rb +34 -0
- data/spec/optional_targets/action_cable_channel_spec.rb +41 -0
- data/spec/optional_targets/amazon_sns_spec.rb +0 -2
- data/spec/optional_targets/slack_spec.rb +0 -2
- data/spec/orm/dynamoid_spec.rb +115 -0
- data/spec/rails_app/Rakefile +9 -0
- data/spec/rails_app/app/assets/config/manifest.js +3 -0
- data/spec/rails_app/app/assets/javascripts/application.js +2 -1
- data/spec/rails_app/app/assets/javascripts/cable.js +12 -0
- data/spec/rails_app/app/controllers/admins_controller.rb +21 -0
- data/spec/rails_app/app/controllers/application_controller.rb +1 -1
- data/spec/rails_app/app/controllers/articles_controller.rb +6 -1
- data/spec/rails_app/app/controllers/comments_controller.rb +3 -1
- data/spec/rails_app/app/controllers/spa_controller.rb +7 -0
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -65
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -73
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -77
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -85
- data/spec/rails_app/app/controllers/users_controller.rb +26 -0
- data/spec/rails_app/app/javascript/App.vue +40 -0
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +82 -0
- data/spec/rails_app/app/javascript/components/Top.vue +98 -0
- data/spec/rails_app/app/javascript/components/notifications/Index.vue +200 -0
- data/spec/rails_app/app/javascript/components/notifications/Notification.vue +133 -0
- data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +122 -0
- data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +279 -0
- data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +112 -0
- data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +141 -0
- data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +226 -0
- data/spec/rails_app/app/javascript/config/development.js +5 -0
- data/spec/rails_app/app/javascript/config/environment.js +7 -0
- data/spec/rails_app/app/javascript/config/production.js +5 -0
- data/spec/rails_app/app/javascript/config/test.js +5 -0
- data/spec/rails_app/app/javascript/packs/application.js +18 -0
- data/spec/rails_app/app/javascript/packs/spa.js +14 -0
- data/spec/rails_app/app/javascript/router/index.js +73 -0
- data/spec/rails_app/app/javascript/store/index.js +37 -0
- data/spec/rails_app/app/models/admin.rb +15 -10
- data/spec/rails_app/app/models/article.rb +25 -20
- data/spec/rails_app/app/models/comment.rb +27 -62
- data/spec/rails_app/app/models/dummy/dummy_base.rb +1 -0
- data/spec/rails_app/app/models/dummy/dummy_group.rb +9 -0
- data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +1 -0
- data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +27 -0
- data/spec/rails_app/app/models/dummy/dummy_notifier.rb +1 -0
- data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +1 -0
- data/spec/rails_app/app/models/dummy/dummy_target.rb +1 -0
- data/spec/rails_app/app/models/user.rb +44 -18
- data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +146 -0
- data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +1 -0
- data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +1 -1
- data/spec/rails_app/app/views/articles/index.html.erb +68 -20
- data/spec/rails_app/app/views/articles/show.html.erb +1 -1
- data/spec/rails_app/app/views/layouts/_header.html.erb +9 -3
- data/spec/rails_app/app/views/spa/index.html.erb +2 -0
- data/spec/rails_app/babel.config.js +72 -0
- data/spec/rails_app/bin/webpack +18 -0
- data/spec/rails_app/bin/webpack-dev-server +18 -0
- data/spec/rails_app/config/application.rb +26 -6
- data/spec/rails_app/config/cable.yml +8 -0
- data/spec/rails_app/config/database.yml +1 -1
- data/spec/rails_app/config/dynamoid.rb +13 -0
- data/spec/rails_app/config/environment.rb +5 -1
- data/spec/rails_app/config/environments/development.rb +5 -0
- data/spec/rails_app/config/environments/production.rb +7 -1
- data/spec/rails_app/config/environments/test.rb +7 -11
- data/spec/rails_app/config/initializers/activity_notification.rb +63 -9
- data/spec/rails_app/config/initializers/copy_it.aws.rb.template +6 -0
- data/spec/rails_app/config/initializers/devise_token_auth.rb +55 -0
- data/spec/rails_app/config/initializers/mysql.rb +9 -0
- data/spec/rails_app/config/locales/activity_notification.en.yml +10 -4
- data/spec/rails_app/config/routes.rb +42 -1
- data/spec/rails_app/config/webpack/development.js +5 -0
- data/spec/rails_app/config/webpack/environment.js +7 -0
- data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
- data/spec/rails_app/config/webpack/production.js +5 -0
- data/spec/rails_app/config/webpack/test.js +5 -0
- data/spec/rails_app/config/webpacker.yml +97 -0
- data/spec/rails_app/db/migrate/{20160715050433_create_test_tables.rb → 20160716000000_create_test_tables.rb} +1 -1
- data/spec/rails_app/db/migrate/{20160715050420_create_activity_notification_tables.rb → 20181209000000_create_activity_notification_tables.rb} +3 -3
- data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +10 -0
- data/spec/rails_app/db/schema.rb +46 -43
- data/spec/rails_app/db/seeds.rb +28 -4
- data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +14 -0
- data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +14 -4
- data/spec/rails_app/package.json +23 -0
- data/spec/rails_app/postcss.config.js +12 -0
- data/spec/roles/acts_as_group_spec.rb +0 -2
- data/spec/roles/acts_as_notifiable_spec.rb +80 -20
- data/spec/roles/acts_as_notifier_spec.rb +0 -2
- data/spec/roles/acts_as_target_spec.rb +1 -5
- data/spec/spec_helper.rb +13 -11
- data/spec/version_spec.rb +31 -0
- metadata +306 -53
- data/.travis.yml +0 -85
- data/Gemfile.lock +0 -234
- data/gemfiles/Gemfile.rails-4.2 +0 -17
- data/gemfiles/Gemfile.rails-4.2.lock +0 -225
- data/gemfiles/Gemfile.rails-5.0.lock +0 -234
- data/gemfiles/Gemfile.rails-5.1.lock +0 -234
- data/spec/rails_app/app/views/activity_notification/notifications/users/overriden/custom/_test.html.erb +0 -1
- /data/spec/rails_app/app/{models → assets/images}/.keep +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</h3>
|
|
6
6
|
|
|
7
7
|
<p>
|
|
8
|
-
<%= link_to "Notifications", notifications_path_for(subscription.target, filtered_by_key: subscription.key) %>
|
|
8
|
+
<%= link_to "Notifications", notifications_path_for(subscription.target, option_params.merge(filtered_by_key: subscription.key)) %>
|
|
9
9
|
</p>
|
|
10
10
|
</div>
|
|
11
11
|
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
<div class="field">
|
|
19
19
|
<div class="ui checkbox">
|
|
20
20
|
<% if subscription.subscribing? %>
|
|
21
|
-
<%= link_to unsubscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false);$(this).parent().parent().parent().next().slideUp();;$(this).parent().parent().parent().next().next().slideUp();', method: :
|
|
21
|
+
<%= link_to unsubscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false);$(this).parent().parent().parent().next().slideUp();;$(this).parent().parent().parent().next().next().slideUp();', method: :put, remote: true do %>
|
|
22
22
|
<%= check_box :subscribing, "", { checked: true }, 'true', 'false' %>
|
|
23
23
|
<div class="slider"></div>
|
|
24
24
|
<% end %>
|
|
25
25
|
<% else %>
|
|
26
26
|
<% if ActivityNotification.config.subscribe_as_default %>
|
|
27
|
-
<%= link_to subscribe_path_for(subscription, option_params), onclick:
|
|
27
|
+
<%= link_to subscribe_path_for(subscription, option_params), onclick: "$(this).find(\"input\").prop(\"checked\", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().find(\"input\").prop(\"checked\", #{ActivityNotification.config.subscribe_to_email_as_default.to_s});$(this).parent().parent().parent().next().next().slideDown();$(this).parent().parent().parent().next().next().find(\"input\").prop(\"checked\", #{ActivityNotification.config.subscribe_to_optional_targets_as_default});", method: :put, remote: true do %>
|
|
28
28
|
<%= check_box :subscribing, "", { checked: false }, 'true', 'false' %>
|
|
29
29
|
<div class="slider"></div>
|
|
30
30
|
<% end %>
|
|
31
31
|
<% else %>
|
|
32
|
-
<%= link_to subscribe_path_for(subscription, option_params
|
|
32
|
+
<%= link_to subscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().next().slideDown();', method: :put, remote: true do %>
|
|
33
33
|
<%= check_box :subscribing, "", { checked: false }, 'true', 'false' %>
|
|
34
34
|
<div class="slider"></div>
|
|
35
35
|
<% end %>
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
<div class="field">
|
|
49
49
|
<div class="ui checkbox">
|
|
50
50
|
<% if subscription.subscribing_to_email? %>
|
|
51
|
-
<%= link_to
|
|
51
|
+
<%= link_to unsubscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false)', method: :put, remote: true do %>
|
|
52
52
|
<label>
|
|
53
53
|
<%= check_box :subscribing_to_email, "", { checked: true }, 'true', 'false' %>
|
|
54
54
|
<div class="slider"></div>
|
|
55
55
|
</label>
|
|
56
56
|
<% end %>
|
|
57
57
|
<% else %>
|
|
58
|
-
<%= link_to
|
|
58
|
+
<%= link_to subscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true)', method: :put, remote: true do %>
|
|
59
59
|
<label>
|
|
60
60
|
<%= check_box :subscribing_to_email, "", { checked: false }, 'true', 'false' %>
|
|
61
61
|
<div class="slider"></div>
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
<div class="field">
|
|
77
77
|
<div class="ui checkbox">
|
|
78
78
|
<% if subscription.subscribing_to_optional_target?(optional_target_name) %>
|
|
79
|
-
<%= link_to
|
|
79
|
+
<%= link_to unsubscribe_to_optional_target_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", false)', method: :put, remote: true do %>
|
|
80
80
|
<label>
|
|
81
81
|
<%= check_box optional_target_name, "", { checked: true }, 'true', 'false' %>
|
|
82
82
|
<div class="slider"></div>
|
|
83
83
|
</label>
|
|
84
84
|
<% end %>
|
|
85
85
|
<% else %>
|
|
86
|
-
<%= link_to
|
|
86
|
+
<%= link_to subscribe_to_optional_target_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", true)', method: :put, remote: true do %>
|
|
87
87
|
<label>
|
|
88
88
|
<%= check_box optional_target_name, "", { checked: false }, 'true', 'false' %>
|
|
89
89
|
<div class="slider"></div>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<div class="subscription_wrapper">
|
|
2
|
+
<div class="subscription_header">
|
|
3
|
+
<h1>Subscriptions for <%= @target.printable_target_name %></h1>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
2
6
|
<% unless @subscriptions.nil? %>
|
|
3
7
|
<div class="subscription_header">
|
|
4
|
-
<
|
|
8
|
+
<h2>Configured subscriptions</h2>
|
|
5
9
|
</div>
|
|
6
10
|
<div class="subscriptions" id="subscriptions">
|
|
7
11
|
<%= render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options %>
|
|
@@ -10,7 +14,7 @@
|
|
|
10
14
|
|
|
11
15
|
<% unless @notification_keys.nil? %>
|
|
12
16
|
<div class="subscription_header">
|
|
13
|
-
<
|
|
17
|
+
<h2>Unconfigured notification keys</h2>
|
|
14
18
|
</div>
|
|
15
19
|
<div class="notification_keys" id="notification_keys">
|
|
16
20
|
<%= render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options %>
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
<% end %>
|
|
19
23
|
|
|
20
24
|
<div class="subscription_header">
|
|
21
|
-
<
|
|
25
|
+
<h2>Create a new subscription</h2>
|
|
22
26
|
</div>
|
|
23
27
|
<div class="subscription_form" id="subscription_form">
|
|
24
28
|
<%= render 'form', target: @target, option_params: @index_options %>
|
|
@@ -26,6 +30,10 @@
|
|
|
26
30
|
</div>
|
|
27
31
|
|
|
28
32
|
<style>
|
|
33
|
+
.subscription_header h1 {
|
|
34
|
+
margin-bottom: 30px;
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
.fields_area {
|
|
30
38
|
border: 1px solid #e5e5e5;
|
|
31
39
|
width: 600px;
|
|
@@ -44,10 +52,6 @@
|
|
|
44
52
|
background-color: #f8f9fb;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
.fields_area .fields_wrapper:last-child {
|
|
48
|
-
border-bottom: none;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
55
|
.fields_area .fields_wrapper .fields_title_wrapper {
|
|
52
56
|
margin-bottom: 16px;
|
|
53
57
|
border-bottom: none;
|
|
@@ -185,9 +189,9 @@
|
|
|
185
189
|
$thisFieldWrapper = $(this).parent().parent().parent().parent();
|
|
186
190
|
if ($(this).prop('checked')) {
|
|
187
191
|
$thisFieldWrapper.next().slideDown();
|
|
188
|
-
$thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.
|
|
192
|
+
$thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_email_as_default %>);
|
|
189
193
|
$thisFieldWrapper.next().next().slideDown();
|
|
190
|
-
$thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.
|
|
194
|
+
$thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_optional_targets_as_default %>);
|
|
191
195
|
} else {
|
|
192
196
|
$thisFieldWrapper.next().slideUp();
|
|
193
197
|
$thisFieldWrapper.next().next().slideUp();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</div>
|
|
5
5
|
<div class="fields_area">
|
|
6
6
|
<div class="subscription" id="subscription">
|
|
7
|
-
<%= render 'subscription', subscription: @subscription, option_params:
|
|
7
|
+
<%= render 'subscription', subscription: @subscription, option_params: @index_options %>
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
@@ -165,9 +165,9 @@
|
|
|
165
165
|
$thisFieldWrapper = $(this).parent().parent().parent().parent();
|
|
166
166
|
if ($(this).prop('checked')) {
|
|
167
167
|
$thisFieldWrapper.next().slideDown();
|
|
168
|
-
$thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.
|
|
168
|
+
$thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_email_as_default %>);
|
|
169
169
|
$thisFieldWrapper.next().next().slideDown();
|
|
170
|
-
$thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.
|
|
170
|
+
$thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_optional_targets_as_default %>);
|
|
171
171
|
} else {
|
|
172
172
|
$thisFieldWrapper.next().slideUp();
|
|
173
173
|
$thisFieldWrapper.next().next().slideUp();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
setTimeout(function () {
|
|
2
2
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
|
3
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
|
3
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
|
4
4
|
}, 400);
|
|
5
5
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
|
6
6
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
|
5
5
|
|
data/app/views/activity_notification/subscriptions/default/subscribe_to_optional_target.js.erb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
setTimeout(function () {
|
|
2
2
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
|
3
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
|
3
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
|
4
4
|
}, 400);
|
|
5
5
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
|
6
6
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
|
5
5
|
|
data/app/views/activity_notification/subscriptions/default/unsubscribe_to_optional_target.js.erb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
|
5
5
|
|
data/bin/_dynamodblocal
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
HEROKU_DEPLOYMENT_BRANCH=heroku-deployment
|
|
4
|
+
|
|
5
|
+
CURRENT_BRANCH=`git symbolic-ref --short HEAD`
|
|
6
|
+
git checkout -b $HEROKU_DEPLOYMENT_BRANCH
|
|
7
|
+
bundle install
|
|
8
|
+
sed -i "" -e "s/^\/Gemfile.lock/# \/Gemfile.lock/g" .gitignore
|
|
9
|
+
cp spec/rails_app/bin/webpack* bin/
|
|
10
|
+
git add .gitignore
|
|
11
|
+
git add Gemfile.lock
|
|
12
|
+
git add bin/webpack*
|
|
13
|
+
git commit -m "Add Gemfile.lock and webpack"
|
|
14
|
+
git push heroku ${HEROKU_DEPLOYMENT_BRANCH}:master --force
|
|
15
|
+
git checkout $CURRENT_BRANCH
|
|
16
|
+
git branch -D $HEROKU_DEPLOYMENT_BRANCH
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Source variables
|
|
4
|
+
. $(dirname $0)/_dynamodblocal
|
|
5
|
+
|
|
6
|
+
if [ -z $JAVA_HOME ]; then
|
|
7
|
+
echo >&2 'ERROR: DynamoDBLocal requires JAVA_HOME to be set.'
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [ ! -x $JAVA_HOME/bin/java ]; then
|
|
12
|
+
echo >&2 'ERROR: JAVA_HOME is set, but I do not see the java executable there.'
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
cd $DIST_DIR
|
|
17
|
+
|
|
18
|
+
if [ ! -f DynamoDBLocal.jar ] || [ ! -d DynamoDBLocal_lib ]; then
|
|
19
|
+
echo >&2 "ERROR: Could not find DynamoDBLocal files in $DIST_DIR."
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
mkdir -p $LOG_DIR
|
|
24
|
+
echo "DynamoDB Local output will save to ${DIST_DIR}/${LOG_DIR}/"
|
|
25
|
+
hash lsof 2>/dev/null && lsof -i :$LISTEN_PORT && { echo >&2 "Something is already listening on port $LISTEN_PORT; I will not attempt to start DynamoDBLocal."; exit 1; }
|
|
26
|
+
|
|
27
|
+
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
28
|
+
nohup $JAVA_HOME/bin/java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -delayTransientStatuses -port $LISTEN_PORT -inMemory 1>"${LOG_DIR}/${NOW}.out.log" 2>"${LOG_DIR}/${NOW}.err.log" &
|
|
29
|
+
PID=$!
|
|
30
|
+
|
|
31
|
+
echo 'Verifying that DynamoDBLocal actually started...'
|
|
32
|
+
|
|
33
|
+
# Allow some seconds for the JDK to start and die.
|
|
34
|
+
counter=0
|
|
35
|
+
while [ $counter -le 5 ]; do
|
|
36
|
+
kill -0 $PID
|
|
37
|
+
if [ $? -ne 0 ]; then
|
|
38
|
+
echo >&2 'ERROR: DynamoDBLocal died after we tried to start it!'
|
|
39
|
+
exit 1
|
|
40
|
+
else
|
|
41
|
+
counter=$(($counter + 1))
|
|
42
|
+
sleep 1
|
|
43
|
+
fi
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
echo "DynamoDB Local started with pid $PID listening on port $LISTEN_PORT."
|
|
47
|
+
echo $PID > $PIDFILE
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Source variables
|
|
4
|
+
. $(dirname $0)/_dynamodblocal
|
|
5
|
+
|
|
6
|
+
cd $DIST_DIR
|
|
7
|
+
|
|
8
|
+
if [ ! -f $PIDFILE ]; then
|
|
9
|
+
echo 'ERROR: There is no pidfile, so if DynamoDBLocal is running you will need to kill it yourself.'
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
pid=$(<$PIDFILE)
|
|
14
|
+
|
|
15
|
+
echo "Killing DynamoDBLocal at pid $pid..."
|
|
16
|
+
kill $pid
|
|
17
|
+
|
|
18
|
+
counter=0
|
|
19
|
+
while [ $counter -le 5 ]; do
|
|
20
|
+
kill -0 $pid 2>/dev/null
|
|
21
|
+
if [ $? -ne 0 ]; then
|
|
22
|
+
echo 'Successfully shut down DynamoDBLocal.'
|
|
23
|
+
rm -f $PIDFILE
|
|
24
|
+
exit 0
|
|
25
|
+
else
|
|
26
|
+
echo 'Still waiting for DynamoDBLocal to shut down...'
|
|
27
|
+
counter=$(($counter + 1))
|
|
28
|
+
sleep 1
|
|
29
|
+
fi
|
|
30
|
+
done
|
|
31
|
+
|
|
32
|
+
echo 'Unable to shut down DynamoDBLocal; you may need to kill it yourself.'
|
|
33
|
+
rm -f $PIDFILE
|
|
34
|
+
exit 1
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at shota.yamazaki.8@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## How to contribute to *activity_notification*
|
|
2
|
+
|
|
3
|
+
#### **Did you find a bug?**
|
|
4
|
+
|
|
5
|
+
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/simukappu/activity_notification/issues).
|
|
6
|
+
|
|
7
|
+
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/simukappu/activity_notification/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible.
|
|
8
|
+
|
|
9
|
+
#### **Did you write code set for a new feature or a patch that fixes a bug?**
|
|
10
|
+
|
|
11
|
+
* Open a new GitHub pull request with your code set.
|
|
12
|
+
|
|
13
|
+
* Ensure the pull request description clearly describes the problem and solution. Include the relevant issue number if applicable.
|
|
14
|
+
|
|
15
|
+
* Before submitting, please check the followings:
|
|
16
|
+
* Write tests with RSpec to cover your changes
|
|
17
|
+
* Write code documents as YARD format to cover your changes
|
|
18
|
+
* Write [README](/README.md) and [Functions](/docs/Functions.md) documents if applicable
|
|
19
|
+
|
|
20
|
+
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
|
|
21
|
+
|
|
22
|
+
* Feel free to create a new GitHub pull request.
|
|
23
|
+
|
|
24
|
+
* If changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of the gem may not be accepted.
|
|
25
|
+
|
|
26
|
+
#### **Do you intend to add a new feature or change an existing one?**
|
|
27
|
+
|
|
28
|
+
* Open an issue on GitHub to suggest your change and collect feedback about the change.
|
|
29
|
+
|
|
30
|
+
#### **Do you have questions about the source code?**
|
|
31
|
+
|
|
32
|
+
* If you're unable to find any answers from public information and your own investigation, you can ask any questions about how to use *activity_notification* by creating GitHub issue.
|
|
33
|
+
|
|
34
|
+
*activity_notification* is a volunteer effort. We appreciate any of your contribution!
|
|
35
|
+
|
|
36
|
+
Thank you!
|