diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index b05f1d67..088b1fe2 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -699,6 +699,15 @@ export default { } } + // Update old party names to new translations + this.template.submitters.forEach((submitter) => { + if (submitter.name === 'First Party') { + submitter.name = this.t('first_party') + } else if (submitter.name === 'Second Party') { + submitter.name = this.t('second_party') + } + }) + const existingSubmittersUuids = this.defaultSubmitters.map((name) => { return this.template.submitters.find(e => e.name === name)?.uuid }) diff --git a/app/javascript/template_builder/i18n.js b/app/javascript/template_builder/i18n.js index 216657e0..16674fab 100644 --- a/app/javascript/template_builder/i18n.js +++ b/app/javascript/template_builder/i18n.js @@ -77,8 +77,8 @@ const en = { add_option: 'Add option', option: 'Option', condition: 'Condition', - first_party: 'First Party', - second_party: 'Second Party', + first_party: 'Employee', + second_party: 'Manager', third_party: 'Third Party', fourth_party: 'Fourth Party', fifth_party: 'Fifth Party', diff --git a/app/models/template.rb b/app/models/template.rb index a2d7fd19..315c580c 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -39,7 +39,7 @@ # fk_rails_... (folder_id => template_folders.id) # class Template < ApplicationRecord - DEFAULT_SUBMITTER_NAME = 'First Party' + DEFAULT_SUBMITTER_NAME = 'Employee' belongs_to :author, class_name: 'User' belongs_to :account diff --git a/app/views/api_settings/index.html.erb b/app/views/api_settings/index.html.erb index 7defd3c2..326b7a07 100644 --- a/app/views/api_settings/index.html.erb +++ b/app/views/api_settings/index.html.erb @@ -41,7 +41,7 @@ "submitters": [ { "name": "John Doe", - "role": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'First Party' %>", + "role": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'Employee' %>", "email": "<%= current_user.email.sub('@', '+test@') %>", "values": { "Form Text Field Name": "Default Value" diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index 7b5853b4..bbdfdd3e 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -43,7 +43,7 @@ en: &en invalid_code: Invalid code unarchive: Unarchive signed: Signed - first_party: 'First Party' + first_party: 'Employee' remove_filter: Remove filter add: Add adding: Adding diff --git a/spec/integration/prefill_integration_spec.rb b/spec/integration/prefill_integration_spec.rb index 6ab95172..801396f8 100644 --- a/spec/integration/prefill_integration_spec.rb +++ b/spec/integration/prefill_integration_spec.rb @@ -45,7 +45,7 @@ RSpec.describe 'ATS Prefill Integration', type: :request do author: user, folder: template_folder, fields: template_fields, - submitters: [{ 'name' => 'First Party', 'uuid' => 'submitter-uuid-1' }]) + submitters: [{ 'name' => 'Employee', 'uuid' => 'submitter-uuid-1' }]) end let(:submission) do @@ -54,7 +54,7 @@ RSpec.describe 'ATS Prefill Integration', type: :request do account: account, created_by_user: user, template_fields: template_fields, - template_submitters: [{ 'name' => 'First Party', 'uuid' => 'submitter-uuid-1' }]) + template_submitters: [{ 'name' => 'Employee', 'uuid' => 'submitter-uuid-1' }]) end let(:submitter) do diff --git a/spec/requests/submissions_spec.rb b/spec/requests/submissions_spec.rb index 7a362ef5..d4e7ba6b 100644 --- a/spec/requests/submissions_spec.rb +++ b/spec/requests/submissions_spec.rb @@ -77,7 +77,7 @@ describe 'Submission API' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, send_email: true, - submitters: [{ role: 'First Party', email: 'john.doe@example.com' }] + submitters: [{ role: 'Employee', email: 'john.doe@example.com' }] }.to_json expect(response).to have_http_status(:ok) @@ -91,7 +91,7 @@ describe 'Submission API' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, send_email: true, - submitters: [{ role: 'First Party', email: 'john.doe@example.com' }], + submitters: [{ role: 'Employee', email: 'john.doe@example.com' }], message: {} }.to_json @@ -105,7 +105,7 @@ describe 'Submission API' do it 'creates a submission when the submitter is marked as completed' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, - submitters: [{ role: 'First Party', email: 'john.doe@example.com', completed: true }] + submitters: [{ role: 'Employee', email: 'john.doe@example.com', completed: true }] }.to_json expect(response).to have_http_status(:ok) @@ -122,7 +122,7 @@ describe 'Submission API' do template_id: multiple_submitters_template.id, send_email: true, submitters: [ - { role: 'First Party', email: 'john.doe@example.com' }, + { role: 'Employee', email: 'john.doe@example.com' }, { email: 'jane.doe@example.com' }, { email: 'mike.doe@example.com' } ] @@ -134,9 +134,9 @@ describe 'Submission API' do expect(response.parsed_body).to eq(JSON.parse(create_submission_body(submission).to_json)) expect(response.parsed_body).to eq(JSON.parse(create_submission_body(submission).to_json)) - expect(response.parsed_body[0]['role']).to eq('First Party') + expect(response.parsed_body[0]['role']).to eq('Employee') expect(response.parsed_body[0]['email']).to eq('john.doe@example.com') - expect(response.parsed_body[1]['role']).to eq('Second Party') + expect(response.parsed_body[1]['role']).to eq('Manager') expect(response.parsed_body[1]['email']).to eq('jane.doe@example.com') expect(response.parsed_body[2]['role']).to eq('Third Party') expect(response.parsed_body[2]['email']).to eq('mike.doe@example.com') @@ -147,7 +147,7 @@ describe 'Submission API' do template_id: templates[0].id, send_email: true, submitters: [ - { role: 'First Party', email: 'john@example' } + { role: 'Employee', email: 'john@example' } ] }.to_json @@ -162,7 +162,7 @@ describe 'Submission API' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, send_email: true, - submitters: [{ role: 'First Party', email: 'john.doe@example.com' }] + submitters: [{ role: 'Employee', email: 'john.doe@example.com' }] }.to_json expect(response).to have_http_status(:unprocessable_entity) @@ -174,8 +174,8 @@ describe 'Submission API' do template_id: multiple_submitters_template.id, send_email: true, submitters: [ - { role: 'First Party', email: 'john.doe@example.com' }, - { role: 'First Party', email: 'jane.doe@example.com' } + { role: 'Employee', email: 'john.doe@example.com' }, + { role: 'Employee', email: 'jane.doe@example.com' } ] }.to_json @@ -189,7 +189,7 @@ describe 'Submission API' do send_email: true, submitters: [ { email: 'jane.doe@example.com' }, - { role: 'First Party', email: 'john.doe@example.com' } + { role: 'Employee', email: 'john.doe@example.com' } ] }.to_json @@ -202,7 +202,7 @@ describe 'Submission API' do template_id: templates[0].id, send_email: true, submitters: [ - { role: 'First Party', email: 'john.doe@example.com' } + { role: 'Employee', email: 'john.doe@example.com' } ], message: { subject: 'Custom Email Subject' diff --git a/spec/requests/templates_spec.rb b/spec/requests/templates_spec.rb index 7763d8cd..a6df983e 100644 --- a/spec/requests/templates_spec.rb +++ b/spec/requests/templates_spec.rb @@ -197,7 +197,7 @@ describe 'Templates API' do fields: template.fields, submitters: [ { - name: 'First Party', + name: 'Employee', uuid: template.submitters.first['uuid'] } ],