mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
Revert "fix: Welcome email copy changes and canned response API error handling [cw-1290] (#6905)"
This reverts commit 07aaa046c1.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
},
|
||||
"API": {
|
||||
"SUCCESS_MESSAGE": "Canned Response added successfully",
|
||||
"ERROR_MESSAGE": "Could not create canned response, Please try again later"
|
||||
"ERROR_MESSAGE": "Could not connect to Woot Server, Please try again later"
|
||||
}
|
||||
},
|
||||
"EDIT": {
|
||||
@@ -56,14 +56,14 @@
|
||||
"BUTTON_TEXT": "Edit",
|
||||
"API": {
|
||||
"SUCCESS_MESSAGE": "Canned Response updated successfully",
|
||||
"ERROR_MESSAGE": "Could not update canned response, Please try again later"
|
||||
"ERROR_MESSAGE": "Could not connect to Woot Server, Please try again later"
|
||||
}
|
||||
},
|
||||
"DELETE": {
|
||||
"BUTTON_TEXT": "Delete",
|
||||
"API": {
|
||||
"SUCCESS_MESSAGE": "Canned response deleted successfully",
|
||||
"ERROR_MESSAGE": "Could not delete canned response, Please try again later"
|
||||
"ERROR_MESSAGE": "Could not connect to Woot Server, Please try again later"
|
||||
},
|
||||
"CONFIRM": {
|
||||
"TITLE": "Confirm Deletion",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:header-title="$t('CANNED_MGMT.ADD.TITLE')"
|
||||
:header-content="$t('CANNED_MGMT.ADD.DESC')"
|
||||
/>
|
||||
<form class="row" @submit.prevent="addCannedResponse()">
|
||||
<form class="row" @submit.prevent="addAgent()">
|
||||
<div class="medium-12 columns">
|
||||
<label :class="{ error: $v.shortCode.$error }">
|
||||
{{ $t('CANNED_MGMT.ADD.FORM.SHORT_CODE.LABEL') }}
|
||||
@@ -107,7 +107,7 @@ export default {
|
||||
this.$v.shortCode.$reset();
|
||||
this.$v.content.$reset();
|
||||
},
|
||||
addCannedResponse() {
|
||||
addAgent() {
|
||||
// Show loading on button
|
||||
this.addCanned.showLoading = true;
|
||||
// Make API Calls
|
||||
@@ -123,11 +123,9 @@ export default {
|
||||
this.resetForm();
|
||||
this.onClose();
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.addCanned.showLoading = false;
|
||||
const errorMessage =
|
||||
error?.message || this.$t('CANNED_MGMT.ADD.API.ERROR_MESSAGE');
|
||||
this.showAlert(errorMessage);
|
||||
this.showAlert(this.$t('CANNED_MGMT.ADD.API.ERROR_MESSAGE'));
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
import { required, minLength } from 'vuelidate/lib/validators';
|
||||
import WootMessageEditor from 'dashboard/components/widgets/WootWriter/Editor';
|
||||
import WootSubmitButton from '../../../../components/buttons/FormSubmitButton';
|
||||
import alertMixin from 'shared/mixins/alertMixin';
|
||||
import Modal from '../../../../components/Modal';
|
||||
|
||||
export default {
|
||||
@@ -66,7 +65,6 @@ export default {
|
||||
Modal,
|
||||
WootMessageEditor,
|
||||
},
|
||||
mixins: [alertMixin],
|
||||
props: {
|
||||
id: { type: Number, default: null },
|
||||
edcontent: { type: String, default: '' },
|
||||
@@ -78,6 +76,7 @@ export default {
|
||||
editCanned: {
|
||||
showAlert: false,
|
||||
showLoading: false,
|
||||
message: '',
|
||||
},
|
||||
shortCode: this.edshortCode,
|
||||
content: this.edcontent,
|
||||
@@ -103,6 +102,9 @@ export default {
|
||||
this.$v.content.$touch();
|
||||
this.content = name;
|
||||
},
|
||||
showAlert() {
|
||||
bus.$emit('newToastMessage', this.editCanned.message);
|
||||
},
|
||||
resetForm() {
|
||||
this.shortCode = '';
|
||||
this.content = '';
|
||||
@@ -122,17 +124,21 @@ export default {
|
||||
.then(() => {
|
||||
// Reset Form, Show success message
|
||||
this.editCanned.showLoading = false;
|
||||
this.showAlert(this.$t('CANNED_MGMT.EDIT.API.SUCCESS_MESSAGE'));
|
||||
this.editCanned.message = this.$t(
|
||||
'CANNED_MGMT.EDIT.API.SUCCESS_MESSAGE'
|
||||
);
|
||||
this.showAlert();
|
||||
this.resetForm();
|
||||
setTimeout(() => {
|
||||
this.onClose();
|
||||
}, 10);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.editCanned.showLoading = false;
|
||||
const errorMessage =
|
||||
error?.message || this.$t('CANNED_MGMT.EDIT.API.ERROR_MESSAGE');
|
||||
this.showAlert(errorMessage);
|
||||
this.editCanned.message = this.$t(
|
||||
'CANNED_MGMT.EDIT.API.ERROR_MESSAGE'
|
||||
);
|
||||
this.showAlert();
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -198,10 +198,8 @@ export default {
|
||||
.then(() => {
|
||||
this.showAlert(this.$t('CANNED_MGMT.DELETE.API.SUCCESS_MESSAGE'));
|
||||
})
|
||||
.catch(error => {
|
||||
const errorMessage =
|
||||
error?.message || this.$t('CANNED_MGMT.DELETE.API.ERROR_MESSAGE');
|
||||
this.showAlert(errorMessage);
|
||||
.catch(() => {
|
||||
this.showAlert(this.$t('CANNED_MGMT.DELETE.API.ERROR_MESSAGE'));
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { throwErrorMessage } from 'dashboard/store/utils/api';
|
||||
import * as MutationHelpers from 'shared/helpers/vuex/mutationHelpers';
|
||||
import * as types from '../mutation-types';
|
||||
import CannedResponseAPI from '../../api/cannedResponse';
|
||||
@@ -47,10 +46,8 @@ const actions = {
|
||||
const response = await CannedResponseAPI.create(cannedObj);
|
||||
commit(types.default.ADD_CANNED, response.data);
|
||||
commit(types.default.SET_CANNED_UI_FLAG, { creatingItem: false });
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
commit(types.default.SET_CANNED_UI_FLAG, { creatingItem: false });
|
||||
return throwErrorMessage(error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -63,10 +60,8 @@ const actions = {
|
||||
const response = await CannedResponseAPI.update(id, updateObj);
|
||||
commit(types.default.EDIT_CANNED, response.data);
|
||||
commit(types.default.SET_CANNED_UI_FLAG, { updatingItem: false });
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
commit(types.default.SET_CANNED_UI_FLAG, { updatingItem: false });
|
||||
return throwErrorMessage(error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -76,10 +71,8 @@ const actions = {
|
||||
await CannedResponseAPI.delete(id);
|
||||
commit(types.default.DELETE_CANNED, id);
|
||||
commit(types.default.SET_CANNED_UI_FLAG, { deletingItem: true });
|
||||
return id;
|
||||
} catch (error) {
|
||||
commit(types.default.SET_CANNED_UI_FLAG, { deletingItem: true });
|
||||
return throwErrorMessage(error);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
<p>Hi, <%= @resource.name %>!</p>
|
||||
<p>Welcome, <%= @resource.name %>!</p>
|
||||
|
||||
<% account_user = @resource&.account_users&.first %>
|
||||
|
||||
<% if account_user&.inviter.present? && @resource.unconfirmed_email.blank? %>
|
||||
<p><%= account_user.inviter.name %>, with <%= account_user.account.name %>, has invited you to try out <%= global_config['BRAND_NAME'] || 'Chatwoot' %>.</p>
|
||||
<p><%= account_user.inviter.name %>, with <%= account_user.account.name %>, has invited you to try out <%= global_config['BRAND_NAME'] || 'Chatwoot' %>! </p>
|
||||
<% end %>
|
||||
|
||||
<% if @resource.confirmed? %>
|
||||
<p>You can login to your <%= global_config['BRAND_NAME'] || 'Chatwoot' %> account through the link below:</p>
|
||||
<p>You can login to your account through the link below:</p>
|
||||
<% else %>
|
||||
<p>
|
||||
Welcome to <%= global_config['BRAND_NAME'] || 'Chatwoot' %>! We have a suite of powerful tools ready for you to explore. Before that we quickly need to verify your email address to know it's really you.
|
||||
</p>
|
||||
<p>Please take a moment and click the link below and activate your account.</p>
|
||||
<p>You can confirm your account email through the link below:</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @resource.unconfirmed_email.present? %>
|
||||
<p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p>
|
||||
<p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p>
|
||||
<% elsif @resource.confirmed? %>
|
||||
<p><%= link_to 'Login to my account', frontend_url('auth/sign_in') %></p>
|
||||
<p><%= link_to 'Login to my account', frontend_url('auth/sign_in') %></p>
|
||||
<% elsif account_user&.inviter.present? %>
|
||||
<p><%= link_to 'Confirm my account', frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %></p>
|
||||
<p><%= link_to 'Confirm my account', frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %></p>
|
||||
<% else %>
|
||||
<p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p>
|
||||
<p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p>
|
||||
<% end %>
|
||||
|
||||
@@ -22,7 +22,7 @@ RSpec.describe 'Confirmation Instructions', type: :mailer do
|
||||
end
|
||||
|
||||
it 'uses the user\'s name' do
|
||||
expect(mail.body).to match("Hi #{CGI.escapeHTML(confirmable_user.name)},")
|
||||
expect(mail.body).to match("Welcome, #{CGI.escapeHTML(confirmable_user.name)}!")
|
||||
end
|
||||
|
||||
it 'does not refer to the inviter and their account' do
|
||||
@@ -39,7 +39,7 @@ RSpec.describe 'Confirmation Instructions', type: :mailer do
|
||||
|
||||
it 'refers to the inviter and their account' do
|
||||
expect(mail.body).to match(
|
||||
"#{CGI.escapeHTML(inviter_val.name)}, with #{CGI.escapeHTML(account.name)}, has invited you to try out Chatwoot."
|
||||
"#{CGI.escapeHTML(inviter_val.name)}, with #{CGI.escapeHTML(account.name)}, has invited you to try out Chatwoot!"
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user