Skip to content

Commit 01bccdf

Browse files
Merge branch 'develop' into ldap-ts
2 parents 83952c4 + 7388867 commit 01bccdf

File tree

11 files changed

+149
-132
lines changed

11 files changed

+149
-132
lines changed

client/views/admin/info/LicenseCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const LicenseCard = ({ statistics, isLoading }) => {
6868
<>
6969
<Feature label={t('Omnichannel')} enabled={hasOmnichannel} />
7070
<Feature label={t('Auditing')} enabled={hasAuditing} />
71-
<Feature label={t('Canned_responses')} enabled={hasCannedResponses} />
71+
<Feature label={t('Canned_Responses')} enabled={hasCannedResponses} />
7272
<Feature label={t('Engagement_Dashboard')} enabled={hasEngagement} />
7373
</>
7474
)}

client/views/omnichannel/departments/EditDepartment.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ import { isEmail } from '../../../../app/utils/client';
2121
import Page from '../../../components/Page';
2222
import { useRoomsList } from '../../../components/RoomAutoComplete/hooks/useRoomsList';
2323
import { useRoute } from '../../../contexts/RouterContext';
24-
import { useMethod } from '../../../contexts/ServerContext';
24+
import { useMethod, useEndpoint } from '../../../contexts/ServerContext';
2525
import { useToastMessageDispatch } from '../../../contexts/ToastMessagesContext';
2626
import { useTranslation } from '../../../contexts/TranslationContext';
2727
import { useRecordList } from '../../../hooks/lists/useRecordList';
2828
import { useComponentDidUpdate } from '../../../hooks/useComponentDidUpdate';
29-
import { useEndpointAction } from '../../../hooks/useEndpointAction';
3029
import { useForm } from '../../../hooks/useForm';
3130
import { AsyncStatePhase } from '../../../lib/asyncState';
3231
import { formsSubscription } from '../additionalForms';
@@ -135,10 +134,7 @@ function EditDepartment({ data, id, title, reload, allowedToForwardData }) {
135134
});
136135

137136
const saveDepartmentInfo = useMethod('livechat:saveDepartment');
138-
const saveDepartmentAgentsInfoOnEdit = useEndpointAction(
139-
'POST',
140-
`livechat/department/${id}/agents`,
141-
);
137+
const saveDepartmentAgentsInfoOnEdit = useEndpoint('POST', `livechat/department/${id}/agents`);
142138

143139
const dispatchToastMessage = useToastMessageDispatch();
144140

@@ -223,7 +219,9 @@ function EditDepartment({ data, id, title, reload, allowedToForwardData }) {
223219
try {
224220
if (id) {
225221
await saveDepartmentInfo(id, payload, []);
226-
await saveDepartmentAgentsInfoOnEdit(agentListPayload);
222+
if (agentListPayload.upsert.length > 0 || agentListPayload.remove.length > 0) {
223+
await saveDepartmentAgentsInfoOnEdit(agentListPayload);
224+
}
227225
} else {
228226
await saveDepartmentInfo(id, payload, agentList);
229227
}

client/views/omnichannel/webhooks/WebhooksPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const reduceSendOptions = (options) =>
2525
return acc;
2626
}, []);
2727

28-
const integrationsUrl = 'https://rocket.chat/docs/administrator-guides/livechat/#integrations';
28+
const integrationsUrl = 'https://docs.rocket.chat/guides/omnichannel/webhooks-managers-guide';
2929

3030
const getInitialValues = ({
3131
Livechat_webhookUrl,
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import { settings } from '../../../../app/settings';
22

33
export const createSettings = () => {
4-
settings.addGroup('Canned_Responses', function() {
5-
this.section('Canned_Responses', function() {
6-
this.add('Canned_Responses_Enable', false, {
7-
type: 'boolean',
8-
public: true,
9-
enterprise: true,
10-
invalidValue: false,
11-
modules: [
12-
'canned-responses',
13-
],
14-
});
15-
});
4+
settings.add('Canned_Responses_Enable', true, {
5+
group: 'Omnichannel',
6+
section: 'Canned_Responses',
7+
type: 'boolean',
8+
public: true,
9+
enterprise: true,
10+
invalidValue: false,
11+
modules: [
12+
'canned-responses',
13+
],
1614
});
1715
};

ee/client/omnichannel/components/contextualBar/CannedResponse/CannedResponseList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const CannedResponseList: FC<{
6363
return (
6464
<>
6565
<VerticalBar.Header>
66-
<VerticalBar.Text>{t('Canned Responses')}</VerticalBar.Text>
66+
<VerticalBar.Text>{t('Canned_Responses')}</VerticalBar.Text>
6767
<VerticalBar.Close onClick={onClose} />
6868
</VerticalBar.Header>
6969

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@babel/preset-react": "^7.14.5",
5959
"@babel/register": "^7.14.5",
6060
"@rocket.chat/eslint-config": "^0.4.0",
61-
"@rocket.chat/livechat": "^1.9.4",
61+
"@rocket.chat/livechat": "^1.9.5",
6262
"@settlin/spacebars-loader": "^1.0.9",
6363
"@storybook/addon-essentials": "^6.3.6",
6464
"@storybook/addon-postcss": "^2.0.0",

packages/rocketchat-i18n/i18n/en.i18n.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,16 +702,16 @@
702702
"Cancel": "Cancel",
703703
"Cancel_message_input": "Cancel",
704704
"Canceled": "Canceled",
705-
"Canned Responses": "Canned Responses",
706705
"Canned_Response_Created": "Canned Response created",
707706
"Canned_Response_Updated": "Canned Response updated",
708707
"Canned_Response_Delete_Warning": "Deleting a canned response cannot be undone.",
709708
"Canned_Response_Removed": "Canned Response Removed",
710709
"Canned_Response_Sharing_Department_Description": "Anyone in the selected department can access this canned response",
711710
"Canned_Response_Sharing_Private_Description": "Only you and Omnichannel managers can access this canned response",
712711
"Canned_Response_Sharing_Public_Description": "Anyone can access this canned response",
713-
"Create_your_First_Canned_Response": "Create Your First Canned Response",
712+
"Canned_Responses": "Canned Responses",
714713
"Canned_Responses_Enable": "Enable Canned Responses",
714+
"Create_your_First_Canned_Response": "Create Your First Canned Response",
715715
"Cannot_invite_users_to_direct_rooms": "Cannot invite users to direct rooms",
716716
"Cannot_open_conversation_with_yourself": "Cannot Direct Message with yourself",
717717
"Cannot_share_your_location": "Cannot share your location...",
@@ -3767,7 +3767,6 @@
37673767
"Setup_Wizard": "Setup Wizard",
37683768
"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.",
37693769
"Share_Location_Title": "Share Location?",
3770-
"Canned_Responses": "Canned responses",
37713770
"New_CannedResponse": "New Canned Response",
37723771
"Edit_CannedResponse": "Edit Canned Response",
37733772
"Sharing": "Sharing",

server/startup/migrations/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,5 @@ import './v233';
233233
import './v234';
234234
import './v235';
235235
import './v236';
236+
import './v237';
236237
import './xrun';

server/startup/migrations/v236.ts

Lines changed: 11 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,21 @@
11
import { Migrations } from '../../../app/migrations/server';
2-
import { settings } from '../../../app/settings/server';
32
import { Settings } from '../../../app/models/server';
4-
import { isEnterprise } from '../../../ee/app/license/server';
5-
6-
function copySettingValue(newName: string, oldName: string): void {
7-
const value = settings.get(oldName);
8-
if (value === undefined) {
9-
return;
10-
}
11-
12-
Settings.upsert({ _id: newName }, { $set: { value } });
13-
}
143

154
Migrations.add({
165
version: 236,
176
up() {
18-
const isEE = isEnterprise();
19-
20-
// Override AD defaults with the previously configured values
21-
copySettingValue('LDAP_AD_User_Search_Field', 'LDAP_User_Search_Field');
22-
copySettingValue('LDAP_AD_Username_Field', 'LDAP_Username_Field');
23-
24-
// If we're sure the server is AD, then select it - otherwise keep it as generic ldap
25-
const useAdDefaults = settings.get('LDAP_User_Search_Field') === 'sAMAccountName';
26-
Settings.upsert({ _id: 'LDAP_Server_Type' }, { $set: { value: useAdDefaults ? 'ad' : '' } });
27-
28-
// The setting to use the field map also determined if the user data was updated on login or not
29-
copySettingValue('LDAP_Update_Data_On_Login', 'LDAP_Sync_User_Data');
30-
31-
let fieldMap;
32-
try {
33-
fieldMap = JSON.parse(settings.get<string>('LDAP_Sync_User_Data_FieldMap') ?? '');
34-
} catch (_error) {
35-
// Ignore any parsing errors;
36-
}
37-
38-
if (fieldMap) {
39-
const newObject: Record<string, string> = {};
40-
41-
for (const key in fieldMap) {
42-
if (!fieldMap.hasOwnProperty(key)) {
43-
continue;
44-
}
7+
Settings.removeById('Canned Responses');
8+
Settings.removeById('Canned_Responses');
459

46-
if (fieldMap[key] === 'name') {
47-
Settings.upsert({ _id: 'LDAP_Name_Field' }, { $set: { value: key } });
48-
Settings.upsert({ _id: 'LDAP_AD_Name_Field' }, { $set: { value: key } });
49-
continue;
50-
}
51-
52-
if (fieldMap[key] === 'email') {
53-
Settings.upsert({ _id: 'LDAP_Email_Field' }, { $set: { value: key } });
54-
Settings.upsert({ _id: 'LDAP_AD_Email_Field' }, { $set: { value: key } });
55-
continue;
56-
}
57-
58-
newObject[fieldMap[key]] = key;
59-
}
60-
61-
if (isEE) {
62-
const newJson = JSON.stringify(newObject);
63-
Settings.upsert({ _id: 'LDAP_CustomFieldMap' }, { $set: { value: newJson } });
64-
65-
const syncCustomFields = Object.keys(newObject).length > 0 && settings.get('LDAP_Sync_User_Data');
66-
Settings.upsert({ _id: 'LDAP_Sync_Custom_Fields' }, { $set: { value: syncCustomFields } });
67-
}
68-
}
69-
70-
copySettingValue('LDAP_Sync_User_Data_Roles', 'LDAP_Sync_User_Data_Groups');
71-
copySettingValue('LDAP_Sync_User_Data_Roles_AutoRemove', 'LDAP_Sync_User_Data_Groups_AutoRemove');
72-
copySettingValue('LDAP_Sync_User_Data_Roles_Filter', 'LDAP_Sync_User_Data_Groups_Filter');
73-
copySettingValue('LDAP_Sync_User_Data_Roles_BaseDN', 'LDAP_Sync_User_Data_Groups_BaseDN');
74-
copySettingValue('LDAP_Sync_User_Data_RolesMap', 'LDAP_Sync_User_Data_GroupsMap');
75-
copySettingValue('LDAP_Sync_User_Data_Channels', 'LDAP_Sync_User_Data_Groups_AutoChannels');
76-
copySettingValue('LDAP_Sync_User_Data_Channels_Admin', 'LDAP_Sync_User_Data_Groups_AutoChannels_Admin');
77-
copySettingValue('LDAP_Sync_User_Data_ChannelsMap', 'LDAP_Sync_User_Data_Groups_AutoChannelsMap');
78-
copySettingValue('LDAP_Sync_User_Data_Channels_Enforce_AutoChannels', 'LDAP_Sync_User_Data_Groups_Enforce_AutoChannels');
79-
80-
copySettingValue('LDAP_Sync_User_Data_Channels_Filter', 'LDAP_Sync_User_Data_Groups_Filter');
81-
copySettingValue('LDAP_Sync_User_Data_Channels_BaseDN', 'LDAP_Sync_User_Data_Groups_BaseDN');
82-
83-
Settings.remove({
84-
_id: {
85-
$in: [
86-
'LDAP_Sync_Now',
87-
'LDAP_Test_Connection',
88-
'LDAP_Sync_CustomFields',
89-
'LDAP_Sync_User_Data',
90-
'LDAP_Sync_User_Data_FieldMap',
91-
'LDAP_Enable_LDAP_Roles_To_RC_Roles',
92-
'LDAP_Roles_To_Rocket_Chat_Roles',
93-
'LDAP_Validate_Roles_For_Each_Login',
94-
'LDAP_Default_Role_To_User',
95-
'LDAP_Query_To_Get_User_Groups',
96-
'LDAP_Sync_User_Data_Groups',
97-
'LDAP_Sync_User_Data_Groups_AutoRemove',
98-
'LDAP_Sync_User_Data_Groups_Filter',
99-
'LDAP_Sync_User_Data_Groups_BaseDN',
100-
'LDAP_Sync_User_Data_GroupsMap',
101-
'LDAP_Sync_User_Data_Groups_AutoChannels',
102-
'LDAP_Sync_User_Data_Groups_AutoChannels_Admin',
103-
'LDAP_Sync_User_Data_Groups_AutoChannelsMap',
104-
'LDAP_Sync_User_Data_Groups_Enforce_AutoChannels',
105-
'LDAP_Internal_Log_Level',
106-
],
10+
Settings.upsert(
11+
{
12+
_id: 'Canned_Responses_Enable',
13+
},
14+
{
15+
$set: {
16+
group: 'Omnichannel',
17+
},
10718
},
108-
});
19+
);
10920
},
11021
});

0 commit comments

Comments
 (0)