Skip to content

Commit

Permalink
[IMPROVE] Canned response admin settings (#23190)
Browse files Browse the repository at this point in the history
* small improvements in canned responses settings

* remove canned response group settings

* fix i18n label

* add migration

Co-authored-by: Kevin Aleman <kevin.aleman@rocket.chat>
  • Loading branch information
tiagoevanp and KevLehman committed Sep 17, 2021
1 parent 0d5b0b3 commit 7388867
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/views/admin/info/LicenseCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const LicenseCard = ({ statistics, isLoading }) => {
<>
<Feature label={t('Omnichannel')} enabled={hasOmnichannel} />
<Feature label={t('Auditing')} enabled={hasAuditing} />
<Feature label={t('Canned_responses')} enabled={hasCannedResponses} />
<Feature label={t('Canned_Responses')} enabled={hasCannedResponses} />
<Feature label={t('Engagement_Dashboard')} enabled={hasEngagement} />
</>
)}
Expand Down
22 changes: 10 additions & 12 deletions ee/app/canned-responses/server/settings.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { settings } from '../../../../app/settings';

export const createSettings = () => {
settings.addGroup('Canned_Responses', function() {
this.section('Canned_Responses', function() {
this.add('Canned_Responses_Enable', false, {
type: 'boolean',
public: true,
enterprise: true,
invalidValue: false,
modules: [
'canned-responses',
],
});
});
settings.add('Canned_Responses_Enable', true, {
group: 'Omnichannel',
section: 'Canned_Responses',
type: 'boolean',
public: true,
enterprise: true,
invalidValue: false,
modules: [
'canned-responses',
],
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const CannedResponseList: FC<{
return (
<>
<VerticalBar.Header>
<VerticalBar.Text>{t('Canned Responses')}</VerticalBar.Text>
<VerticalBar.Text>{t('Canned_Responses')}</VerticalBar.Text>
<VerticalBar.Close onClick={onClose} />
</VerticalBar.Header>

Expand Down
5 changes: 2 additions & 3 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,16 +702,16 @@
"Cancel": "Cancel",
"Cancel_message_input": "Cancel",
"Canceled": "Canceled",
"Canned Responses": "Canned Responses",
"Canned_Response_Created": "Canned Response created",
"Canned_Response_Updated": "Canned Response updated",
"Canned_Response_Delete_Warning": "Deleting a canned response cannot be undone.",
"Canned_Response_Removed": "Canned Response Removed",
"Canned_Response_Sharing_Department_Description": "Anyone in the selected department can access this canned response",
"Canned_Response_Sharing_Private_Description": "Only you and Omnichannel managers can access this canned response",
"Canned_Response_Sharing_Public_Description": "Anyone can access this canned response",
"Create_your_First_Canned_Response": "Create Your First Canned Response",
"Canned_Responses": "Canned Responses",
"Canned_Responses_Enable": "Enable Canned Responses",
"Create_your_First_Canned_Response": "Create Your First Canned Response",
"Cannot_invite_users_to_direct_rooms": "Cannot invite users to direct rooms",
"Cannot_open_conversation_with_yourself": "Cannot Direct Message with yourself",
"Cannot_share_your_location": "Cannot share your location...",
Expand Down Expand Up @@ -3751,7 +3751,6 @@
"Setup_Wizard": "Setup Wizard",
"Setup_Wizard_Info": "We'll guide you through setting up your first admin user, configuring your organisation and registering your server to receive free push notifications and more.",
"Share_Location_Title": "Share Location?",
"Canned_Responses": "Canned responses",
"New_CannedResponse": "New Canned Response",
"Edit_CannedResponse": "Edit Canned Response",
"Sharing": "Sharing",
Expand Down
1 change: 1 addition & 0 deletions server/startup/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,5 @@ import './v232';
import './v233';
import './v234';
import './v235';
import './v236';
import './xrun';
21 changes: 21 additions & 0 deletions server/startup/migrations/v236.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Migrations } from '../../../app/migrations/server';
import { Settings } from '../../../app/models/server';

Migrations.add({
version: 236,
up() {
Settings.removeById('Canned Responses');
Settings.removeById('Canned_Responses');

Settings.upsert(
{
_id: 'Canned_Responses_Enable',
},
{
$set: {
group: 'Omnichannel',
},
},
);
},
});

0 comments on commit 7388867

Please sign in to comment.