mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Fix Add button height in git settings
This commit is contained in:
8 files changed
+6
-85
No files matched your search
@@ -161,7 +161,6 @@ describe('configUtils', () => {
|
||||
password: 'token123',
|
||||
},
|
||||
},
|
||||
hostTokens: {},
|
||||
};
|
||||
|
||||
describe('readGitSettings', () => {
|
||||
@@ -182,7 +181,6 @@ describe('configUtils', () => {
|
||||
|
||||
expect(result).toEqual({
|
||||
credentials: {},
|
||||
hostTokens: {},
|
||||
coAuthorEnabled: true,
|
||||
});
|
||||
});
|
||||
|
||||
+1
-15
@@ -62,16 +62,8 @@ const gitCredentialSchema = z.object({
|
||||
password: z.string(),
|
||||
});
|
||||
|
||||
const gitHostTokenSchema = z.object({
|
||||
token: z.string(),
|
||||
username: z.string().optional(),
|
||||
scopes: z.array(z.string()).optional(),
|
||||
createdAt: z.number().optional(),
|
||||
});
|
||||
|
||||
const gitSettingsSchema = z.object({
|
||||
credentials: z.record(z.string(), gitCredentialSchema),
|
||||
hostTokens: z.record(z.string(), gitHostTokenSchema).optional(),
|
||||
name: z.string().optional(),
|
||||
email: z.string().optional(),
|
||||
coAuthorEnabled: z.boolean().optional(),
|
||||
@@ -220,7 +212,6 @@ export async function writeAISettings(fs: JSRuntimeFS, settings: AISettings, con
|
||||
export async function readGitSettings(fs: JSRuntimeFS, configPath = '/config'): Promise<GitSettings> {
|
||||
const defaultSettings: GitSettings = {
|
||||
credentials: {},
|
||||
hostTokens: {},
|
||||
coAuthorEnabled: true,
|
||||
};
|
||||
|
||||
@@ -229,12 +220,7 @@ export async function readGitSettings(fs: JSRuntimeFS, configPath = '/config'):
|
||||
const gitConfigPath = getGitConfigPath(configPath);
|
||||
const content = await fs.readFile(gitConfigPath, 'utf8');
|
||||
const data = JSON.parse(content);
|
||||
const parsed = gitSettingsSchema.parse(data);
|
||||
// Ensure hostTokens exists even if not in parsed data
|
||||
return {
|
||||
...parsed,
|
||||
hostTokens: parsed.hostTokens || {},
|
||||
};
|
||||
return gitSettingsSchema.parse(data);
|
||||
} catch {
|
||||
return defaultSettings;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,6 @@ describe('Git', () => {
|
||||
const { readGitSettings } = await import('./configUtils');
|
||||
vi.mocked(readGitSettings).mockResolvedValue({
|
||||
credentials: {},
|
||||
hostTokens: {},
|
||||
coAuthorEnabled: true,
|
||||
});
|
||||
|
||||
@@ -334,7 +333,6 @@ describe('Git', () => {
|
||||
const { readGitSettings } = await import('./configUtils');
|
||||
vi.mocked(readGitSettings).mockResolvedValue({
|
||||
credentials: {},
|
||||
hostTokens: {},
|
||||
name: 'John Doe',
|
||||
email: '[email protected]',
|
||||
coAuthorEnabled: true,
|
||||
@@ -364,7 +362,6 @@ describe('Git', () => {
|
||||
const { readGitSettings } = await import('./configUtils');
|
||||
vi.mocked(readGitSettings).mockResolvedValue({
|
||||
credentials: {},
|
||||
hostTokens: {},
|
||||
name: 'John Doe',
|
||||
email: '[email protected]',
|
||||
coAuthorEnabled: false,
|
||||
@@ -394,7 +391,6 @@ describe('Git', () => {
|
||||
const { readGitSettings } = await import('./configUtils');
|
||||
vi.mocked(readGitSettings).mockResolvedValue({
|
||||
credentials: {},
|
||||
hostTokens: {},
|
||||
name: 'John Doe',
|
||||
email: '[email protected]',
|
||||
coAuthorEnabled: true,
|
||||
|
||||
Reference in new issue
Block a user