Skip to content

Commit 457cb28

Browse files
authored
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
1 parent c5eb3a2 commit 457cb28

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

.changeset/little-carpets-change.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@logto/console": patch
3+
"@logto/schemas": patch
4+
---
5+
6+
Adding social connectors will now mark the related get-started action item as completed.

packages/console/src/pages/Connectors/components/Guide/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ function Guide({ connector, onClose }: Props) {
125125
})
126126
.json<ConnectorResponse>();
127127

128-
await updateConfigs({
129-
...conditional(!isSocialConnector && { passwordlessConfigured: true }),
130-
});
128+
await updateConfigs({ passwordlessConfigured: true });
131129

132130
onClose();
133131
toast.success(t('general.saved'));
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { sql } from 'slonik';
2+
3+
import type { AlterationScript } from '../lib/types/alteration.js';
4+
5+
const adminConsoleConfigKey = 'adminConsole';
6+
7+
const alteration: AlterationScript = {
8+
up: async (pool) => {
9+
const tenantIds = await pool.many<{ id: string }>(sql`select id from tenants`);
10+
11+
await Promise.all(
12+
tenantIds.map(async ({ id }) => {
13+
const { count } = await pool.one<{ count: number }>(sql`
14+
select count(*) from connectors
15+
where tenant_id = ${id} and connector_id <> 'logto-sms' and connector_id <> 'logto-email' and connector_id <> 'logto-social-demo';
16+
`);
17+
18+
if (count > 0) {
19+
await pool.query(sql`
20+
update logto_configs set value = jsonb_set(value, '{passwordlessConfigured}', 'true')
21+
where tenant_id = ${id} and key = ${adminConsoleConfigKey};
22+
`);
23+
}
24+
})
25+
);
26+
},
27+
down: async () => {
28+
// Do nothing as there is no alteration made to the DB schemas, only fixing data.
29+
},
30+
};
31+
32+
export default alteration;

0 commit comments

Comments
 (0)