From 99b3688c57014ba4c9b35a3d360224390b4ebff5 Mon Sep 17 00:00:00 2001 From: cgonzalez Date: Mon, 11 Oct 2021 10:52:00 +0100 Subject: [PATCH 1/3] Add setting to disable import emails --- app/models/carto/user_email_notification.rb | 3 ++- lib/assets/javascripts/locale/en.json | 3 ++- lib/resque/user_jobs.rb | 2 ++ package-lock.json | 2 +- package.json | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/carto/user_email_notification.rb b/app/models/carto/user_email_notification.rb index cf801608ab..4d4e779f9f 100644 --- a/app/models/carto/user_email_notification.rb +++ b/app/models/carto/user_email_notification.rb @@ -7,7 +7,8 @@ module Carto validate :valid_notification NOTIFICATION_DO_SUBSCRIPTIONS = 'do_subscriptions'.freeze - VALID_NOTIFICATIONS = [NOTIFICATION_DO_SUBSCRIPTIONS].freeze + NOTIFICATION_IMPORTS = 'imports'.freeze + VALID_NOTIFICATIONS = [NOTIFICATION_DO_SUBSCRIPTIONS, NOTIFICATION_IMPORTS].freeze def self.new_do_subscriptions(user_id) Carto::UserEmailNotification.create!( diff --git a/lib/assets/javascripts/locale/en.json b/lib/assets/javascripts/locale/en.json index ac3ad39ebd..a477a1b09f 100644 --- a/lib/assets/javascripts/locale/en.json +++ b/lib/assets/javascripts/locale/en.json @@ -92,7 +92,8 @@ "notifications": { "enabled": "On", "disabled": "Off", - "do_subscriptions":"Emails from Data Observatory" + "do_subscriptions": "Emails from Data Observatory", + "imports": "Emails from Imports" } } } diff --git a/lib/resque/user_jobs.rb b/lib/resque/user_jobs.rb index 0014416908..81f63ce207 100644 --- a/lib/resque/user_jobs.rb +++ b/lib/resque/user_jobs.rb @@ -191,6 +191,8 @@ module Resque def self.perform(user_id, imported_tables, total_tables, first_imported_table, first_table, errors, filenames) u = ::User.where(id: user_id).first + return unless u.carto_user.email_notification_enabled?(Carto::UserEmailNotification::NOTIFICATION_IMPORTS) + ImportMailer.data_import_finished(u, imported_tables, total_tables, first_imported_table, first_table, errors, filenames).deliver_now end diff --git a/package-lock.json b/package-lock.json index 2851d59706..b1124157ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cartodb-ui", - "version": "1.0.0-assets.265", + "version": "1.0.0-assets.267", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 39944023f2..5c9637b8e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cartodb-ui", - "version": "1.0.0-assets.265", + "version": "1.0.0-assets.267", "description": "CARTO UI frontend", "repository": { "type": "git", From 5a8a447d4db08a3a983f42439434fdf0a80eab12 Mon Sep 17 00:00:00 2001 From: cgonzalez Date: Mon, 11 Oct 2021 10:55:41 +0100 Subject: [PATCH 2/3] Update NEWS.md --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index cc7defd0c5..4b33b8c138 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,7 @@ Development * Include DB connections, all parameters for Oauth connections, and the relationship between synchronizations and connections, in User migrations [#16287](https://github.com/CartoDB/cartodb/pull/16287) * Upgrade to CARTO Viewer v1.0.8 [16347](https://github.com/CartoDB/cartodb/pull/16347) * Show user's database location in profile [16349](https://github.com/CartoDB/cartodb/pull/16349) +* Setting to enable/disable import notifications [16354](https://github.com/CartoDB/cartodb/pull/16354) ### Bug fixes / enhancements - Add "element" param to DO-Catalog entry function [#16343](https://github.com/CartoDB/cartodb/pull/16343) From 783abb119fc64a1af1480fe3ec5ec25803061b64 Mon Sep 17 00:00:00 2001 From: cgonzalez Date: Wed, 13 Oct 2021 09:14:36 +0100 Subject: [PATCH 3/3] Bump assets version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index b1124157ef..ae1eacb9dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cartodb-ui", - "version": "1.0.0-assets.267", + "version": "1.0.0-assets.268", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5c9637b8e1..2d8b7b1eaf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cartodb-ui", - "version": "1.0.0-assets.267", + "version": "1.0.0-assets.268", "description": "CARTO UI frontend", "repository": { "type": "git",