Просмотр исходного кода

Follow up eb52e11 - Fixes #4838 - Data retention rules for cleanup users (or other objects) from the system with the scheduler.

Dusan Vuckovic 1 год назад
Родитель
Сommit
1b53185458

+ 3 - 3
app/assets/javascripts/app/controllers/_ui_element/object_perform_action.coffee

@@ -112,8 +112,8 @@ class App.UiElement.object_perform_action extends App.UiElement.ApplicationActio
         translate: true
         options: availableActions
         alerts:
-          delete: __('All affected tickets will be deleted immediately when this job is run. There is no rollback of this deletion possible.')
-          data_privacy_deletion_task: __('All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, there is no rollback of this deletion possible.')
+          delete: __('All affected tickets will be deleted immediately when this job is run, without a history entry. There is no rollback of this deletion possible.')
+          data_privacy_deletion_task: __('All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible.')
 
     # Add data privacy deletion task action for the user object.
     if attribute.object_name is 'User' and attribute.data_privacy_deletion_task
@@ -126,7 +126,7 @@ class App.UiElement.object_perform_action extends App.UiElement.ApplicationActio
         options:
           data_privacy_deletion_task: __('Add a data privacy deletion task')
         alerts:
-          data_privacy_deletion_task: __('All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, there is no rollback of this deletion possible.')
+          data_privacy_deletion_task: __('All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, users and tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible.')
 
     # add sender type selection as a ticket attribute
     if attribute.object_name is 'Ticket' and attribute.sender_type

+ 2 - 2
app/assets/javascripts/app/controllers/_ui_element/object_selector.coffee

@@ -41,8 +41,8 @@ class App.UiElement.object_selector extends App.UiElement.ApplicationSelectorExp
 
     switch attribute.object_name
       when 'Ticket' then defaults.push 'ticket.state_id'
-      when 'User' then defaults.push 'user.firstname'
-      when 'Organization' then defaults.push 'organization.name'
+      when 'User' then defaults.push 'user.role_ids'
+      when 'Organization' then defaults.push 'organization.members_existing'
 
     for key, data of groups
       continue if _.contains(data.model_show, attribute.object_name)

+ 1 - 6
app/assets/javascripts/app/views/data_privacy/tasks.jst.eco

@@ -5,8 +5,6 @@
       <div class="action-flow action-flow--noWrap">
         <% if task.preferences.user: %>
           <h2><%- @T('Delete User') %></h2>
-        <% else if task.preferences.organization: %>
-          <h2><%- @T('Delete Organization') %></h2>
         <% else if task.preferences.ticket: %>
           <h2><%- @T('Delete Ticket') %></h2>
         <% end %>
@@ -17,14 +15,11 @@
         <% if task.preferences.user: %>
           <div class="label"><%- @T('User (censored):') %></div>
           <%= task.preferences.user.firstname %> <%= task.preferences.user.lastname %> (<%= task.preferences.user.email %>)
-          <% if task.preferences.user.organization && task.preferences.delete_organization: %>
+          <% if task.preferences.delete_organization: %>
           <br><br>
           <div class="label"><%- @T('Deleted Organization:') %></div>
           <%= task.preferences.user.organization %>
           <% end %>
-        <% else if task.preferences.organization: %>
-          <div class="label"><%- @T('Organization (censored):') %></div>
-          <%= task.preferences.organization.name %>
         <% else if task.preferences.ticket: %>
           <div class="label"><%- @T('Ticket (censored):') %></div>
           <%= task.preferences.ticket.title %>

+ 3 - 11
i18n/zammad.pot

@@ -1044,15 +1044,15 @@ msgid "All Tickets"
 msgstr ""
 
 #: app/assets/javascripts/app/controllers/_ui_element/object_perform_action.coffee
-msgid "All affected tickets will be deleted immediately when this job is run. There is no rollback of this deletion possible."
+msgid "All affected tickets will be deleted immediately when this job is run, without a history entry. There is no rollback of this deletion possible."
 msgstr ""
 
 #: app/assets/javascripts/app/controllers/_ui_element/object_perform_action.coffee
-msgid "All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, there is no rollback of this deletion possible."
+msgid "All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible."
 msgstr ""
 
 #: app/assets/javascripts/app/controllers/_ui_element/object_perform_action.coffee
-msgid "All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, there is no rollback of this deletion possible."
+msgid "All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, users and tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible."
 msgstr ""
 
 #: app/assets/javascripts/app/controllers/_ui_element/_application_action.coffee
@@ -4021,10 +4021,6 @@ msgstr ""
 msgid "Delete Knowledge Base"
 msgstr ""
 
-#: app/assets/javascripts/app/views/data_privacy/tasks.jst.eco
-msgid "Delete Organization"
-msgstr ""
-
 #: app/assets/javascripts/app/views/data_privacy/tasks.jst.eco
 msgid "Delete Ticket"
 msgstr ""
@@ -8492,10 +8488,6 @@ msgstr ""
 msgid "Organization & Department Name"
 msgstr ""
 
-#: app/assets/javascripts/app/views/data_privacy/tasks.jst.eco
-msgid "Organization (censored):"
-msgstr ""
-
 #: app/assets/javascripts/app/views/getting_started/base.jst.eco
 msgid "Organization Name"
 msgstr ""

+ 11 - 2
public/assets/tests/qunit/form_object_perform_action.js

@@ -117,6 +117,8 @@ QUnit.test('defaults to ticket object', (assert) => {
     },
   }
   assert.deepEqual(params, test_params, 'params structure')
+
+
 })
 
 QUnit.test('supports ticket object', (assert) => {
@@ -158,7 +160,14 @@ QUnit.test('supports ticket object', (assert) => {
   assert.deepEqual(el.find('.js-value option').map(function () { return $(this).attr('value') }).toArray(), ['data_privacy_deletion_task', 'delete'], 'has correct actions')
 
   // Alert
-  assert.equal(el.find('.js-alert').text(), 'All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, there is no rollback of this deletion possible.', 'has proper warning shown')
+  assert.equal(el.find('.js-alert').text(), 'All affected tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible.', 'has proper warning shown')
+
+  el.find('select[name="perform::ticket.action::value"]')
+    .val('delete')
+    .trigger('change')
+
+  // Alert #2
+  assert.equal(el.find('.js-alert').text(), 'All affected tickets will be deleted immediately when this job is run, without a history entry. There is no rollback of this deletion possible.')
 })
 
 QUnit.test('supports user object', (assert) => {
@@ -201,5 +210,5 @@ QUnit.test('supports user object', (assert) => {
   assert.deepEqual(el.find('.js-value option').map(function () { return $(this).attr('value') }).toArray(), ['data_privacy_deletion_task'], 'has correct actions')
 
   // Alert
-  assert.equal(el.find('.js-alert').text(), 'All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, there is no rollback of this deletion possible.', 'has proper warning shown')
+  assert.equal(el.find('.js-alert').text(), 'All affected users and their customer tickets will be scheduled for deletion when this job is run. Once the data privacy task is executed, users and tickets will be deleted and a history entry preserved. There is no rollback of this deletion possible.', 'has proper warning shown')
 })

+ 12 - 12
public/assets/tests/qunit/form_object_selector.js

@@ -177,9 +177,9 @@ QUnit.test('supports user object', (assert) => {
   var params = App.ControllerForm.params(el)
   var test_params = {
     condition: {
-      'user.firstname': { // default
-        operator: 'contains',
-        value: '',
+      'user.role_ids': { // default
+        operator: 'is',
+        value: [],
       },
     },
   }
@@ -222,9 +222,9 @@ QUnit.test('supports organization object', (assert) => {
   var params = App.ControllerForm.params(el)
   var test_params = {
     condition: {
-      'organization.name': { // default
-        operator: 'contains',
-        value: '',
+      'organization.members_existing': { // default
+        operator: 'is',
+        value: true,
       },
     },
   }
@@ -322,9 +322,9 @@ QUnit.test('supports user object', (assert) => {
   var params = App.ControllerForm.params(el)
   var test_params = {
     condition: {
-      'user.firstname': { // default
-        operator: 'contains',
-        value: '',
+      'user.role_ids': { // default
+        operator: 'is',
+        value: [],
       },
     },
   }
@@ -367,9 +367,9 @@ QUnit.test('supports organization object', (assert) => {
   var params = App.ControllerForm.params(el)
   var test_params = {
     condition: {
-      'organization.name': { // default
-        operator: 'contains',
-        value: '',
+      'organization.members_existing': { // default
+        operator: 'is',
+        value: true,
       },
     },
   }