The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/server/startup/migrations/v040.js

40 lines
1.0 KiB

RocketChat.Migrations.add({
version: 40,
up() {
RocketChat.models.Settings.find({ _id: /Accounts_OAuth_Custom_/, i18nLabel: 'Accounts_OAuth_Custom_Enable' }).forEach(function(customOauth) {
const parts = customOauth._id.split('_');
const name = parts[3];
const id = `Accounts_OAuth_Custom_${ name }_token_sent_via`;
if (!RocketChat.models.Settings.findOne({ _id: id })) {
RocketChat.models.Settings.insert({
_id: id,
type: 'select',
group: 'OAuth',
section: `Custom OAuth: ${ name }`,
i18nLabel: 'Accounts_OAuth_Custom_Token_Sent_Via',
persistent: true,
values: [
{
key: 'header',
i18nLabel: 'Header',
},
{
key: 'payload',
i18nLabel: 'Payload',
},
],
packageValue: 'payload',
valueSource: 'packageValue',
ts: new Date(),
hidden: false,
blocked: false,
sorter: 255,
i18nDescription: `Accounts_OAuth_Custom_${ name }_token_sent_via_Description`,
createdAt: new Date(),
value: 'payload',
});
}
});
},
});