diff --git a/lib/travis/addons/gdpr/mailer/gdpr_mailer.rb b/lib/travis/addons/gdpr/mailer/gdpr_mailer.rb index 5bbd436f..263c3c2d 100644 --- a/lib/travis/addons/gdpr/mailer/gdpr_mailer.rb +++ b/lib/travis/addons/gdpr/mailer/gdpr_mailer.rb @@ -24,6 +24,42 @@ def purge(receivers, request_date) mail(from: travis_email, to: receivers, subject: 'Your data was purged', template_path: 'gdpr_mailer') end + # Retention policy notifications + + def data_retention_notice(receivers, owner, retention) + @owner = owner + @retention = retention + mail( + from: travis_email, + to: receivers, + subject: "Notice: Data Stored at Travis CI Older Than #{retention[:months]} Months", + template_path: 'gdpr_mailer' + ) + end + + def upcoming_data_deletion_notice(receivers, owner, retention) + @owner = owner + @retention = retention + days = (retention[:days_until_deletion]).to_i + mail( + from: travis_email, + to: receivers, + subject: "Reminder: Scheduled Deletion of Data Older Than #{retention[:months]} Months in #{days} Days", + template_path: 'gdpr_mailer' + ) + end + + def data_deletion_confirmation(receivers, owner, retention) # Comes from travis-gdpr + @owner = owner + @retention = retention + mail( + from: travis_email, + to: receivers, + subject: "Confirmation: Data Older Than #{retention[:months]} Months Has Been Removed", + template_path: 'gdpr_mailer' + ) + end + private def travis_email diff --git a/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/data_deletion_confirmation.html.erb b/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/data_deletion_confirmation.html.erb new file mode 100644 index 00000000..000de682 --- /dev/null +++ b/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/data_deletion_confirmation.html.erb @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + +
+ Travis CI Logo +
+

Confirmation: Data Older Than <%= @retention[:months] %> Months Has Been Removed

+
+

Hello <%= @owner[:name] %>,

+

This is an automated confirmation from Travis CI.

+

As part of our storage retention policy, the following types of data older than <%= @retention[:months] %> months have been permanently removed from your account:

+
    +
  • Cached artifacts
  • +
  • Build logs
  • +
  • Customized images
  • +
+

+ No further action is required on your part. +
+ If you have questions about this removal or our retention policy, please refer to our + documentation or contact our support team. +

+
+

+ Thank you for your understanding, +
+ Travis CI Support Team +

+
+ + + + + + + + + + + +
+
+ + diff --git a/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/data_retention_notice.html.erb b/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/data_retention_notice.html.erb new file mode 100644 index 00000000..3fc171af --- /dev/null +++ b/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/data_retention_notice.html.erb @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + +
+ Travis CI Logo +
+

Notice: Data Stored at Travis CI Older Than <%= @retention[:months] %> Months

+
+

Hello <%= @owner[:name] %>,

+

This is an automated notification from Travis CI.

+

We have detected that some of your stored data is older than <%= @retention[:months] %> months. This may include (but is not limited to):

+
    +
  • Cached artifacts
  • +
  • Build logs
  • +
  • Customized images
  • +
+

Please review and, if necessary, back up or remove this data to ensure continued compliance with storage policies and to free up space for future.

+

If no action is taken, older data may be subject to automatic removal in accordance with our retention policy (within next <%= @retention[:days_until_deletion] %> days).

+

+ For details on managing stored data, please refer to our documentation. +

+
+

+ Thank you for your attention, +
+ Travis CI Support Team +

+
+ + + + + + + + + + + +
+
+ + diff --git a/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/upcoming_data_deletion_notice.html.erb b/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/upcoming_data_deletion_notice.html.erb new file mode 100644 index 00000000..73548d7f --- /dev/null +++ b/lib/travis/addons/gdpr/mailer/views/gdpr_mailer/upcoming_data_deletion_notice.html.erb @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + +
+ Travis CI Logo +
+ <% days = (@retention[:days_until_deletion]).to_i %> +

Reminder: Scheduled Deletion of Data Older Than <%= @retention[:months] %> Months in <%= days %> Days

+
+

Hello <%= @owner[:name] %>,

+

This is an automated reminder from Travis CI.

+ <% days_body_label = days == 1 ? 'day' : 'days' %> +

Some of your stored data is older than <%= @retention[:months] %> months and is scheduled for automatic deletion in <%= days %> <%= days_body_label %>. This may include (but is not limited to):

+
    +
  • Cached artifacts
  • +
  • Build logs
  • +
  • Customized images
  • +
+

If you wish to retain this data, please back it up or update it before the scheduled removal date.

+

+ For guidance on managing stored data, please see our documentation. +

+
+

+ Thank you for helping us maintain a clean and efficient storage environment, +
+ Travis CI Support Team +

+
+ + + + + + + + + + + +
+
+ + diff --git a/lib/travis/addons/gdpr/task.rb b/lib/travis/addons/gdpr/task.rb index 6f1e40be..c37a5283 100644 --- a/lib/travis/addons/gdpr/task.rb +++ b/lib/travis/addons/gdpr/task.rb @@ -18,6 +18,12 @@ def send_email Mailer::GdprMailer.support_export(recipients, params.fetch(:user_name), params.fetch(:url)).deliver when 'purge' Mailer::GdprMailer.purge(recipients, params.fetch(:request_date)).deliver + when 'data_retention_notice' + Mailer::GdprMailer.data_retention_notice(recipients, params.fetch(:owner), params.fetch(:retention)).deliver + when 'upcoming_data_deletion_notice' + Mailer::GdprMailer.upcoming_data_deletion_notice(recipients, params.fetch(:owner), params.fetch(:retention)).deliver + when 'data_deletion_confirmation' + Mailer::GdprMailer.data_deletion_confirmation(recipients, params.fetch(:owner), params.fetch(:retention)).deliver else raise NoMailType, "#{type} is not a valid email type" end