mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(console): adding social connector should mark related get-started action item as completed (#3693)
* fix(console): adding social connector should mark related get-started action item as completed * chore: add changeset
This commit is contained in:
parent
c5eb3a2ba7
commit
457cb28224
3 changed files with 39 additions and 3 deletions
6
.changeset/little-carpets-change.md
Normal file
6
.changeset/little-carpets-change.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
"@logto/console": patch
|
||||||
|
"@logto/schemas": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Adding social connectors will now mark the related get-started action item as completed.
|
|
@ -125,9 +125,7 @@ function Guide({ connector, onClose }: Props) {
|
||||||
})
|
})
|
||||||
.json<ConnectorResponse>();
|
.json<ConnectorResponse>();
|
||||||
|
|
||||||
await updateConfigs({
|
await updateConfigs({ passwordlessConfigured: true });
|
||||||
...conditional(!isSocialConnector && { passwordlessConfigured: true }),
|
|
||||||
});
|
|
||||||
|
|
||||||
onClose();
|
onClose();
|
||||||
toast.success(t('general.saved'));
|
toast.success(t('general.saved'));
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import { sql } from 'slonik';
|
||||||
|
|
||||||
|
import type { AlterationScript } from '../lib/types/alteration.js';
|
||||||
|
|
||||||
|
const adminConsoleConfigKey = 'adminConsole';
|
||||||
|
|
||||||
|
const alteration: AlterationScript = {
|
||||||
|
up: async (pool) => {
|
||||||
|
const tenantIds = await pool.many<{ id: string }>(sql`select id from tenants`);
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
tenantIds.map(async ({ id }) => {
|
||||||
|
const { count } = await pool.one<{ count: number }>(sql`
|
||||||
|
select count(*) from connectors
|
||||||
|
where tenant_id = ${id} and connector_id <> 'logto-sms' and connector_id <> 'logto-email' and connector_id <> 'logto-social-demo';
|
||||||
|
`);
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
await pool.query(sql`
|
||||||
|
update logto_configs set value = jsonb_set(value, '{passwordlessConfigured}', 'true')
|
||||||
|
where tenant_id = ${id} and key = ${adminConsoleConfigKey};
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
down: async () => {
|
||||||
|
// Do nothing as there is no alteration made to the DB schemas, only fixing data.
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default alteration;
|
Loading…
Reference in a new issue