Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ export class Store {
['email_job_updates', 'INTEGER NOT NULL DEFAULT 1'],
['email_daily_digest', 'INTEGER NOT NULL DEFAULT 1'],
['notify_email', 'TEXT'],
['allow_private_models', 'INTEGER NOT NULL DEFAULT 0'],
['github_token_scopes', 'TEXT'],
]
for (const [name, type] of additions) {
Expand All @@ -747,7 +748,6 @@ export class Store {
['allow_paths', "TEXT NOT NULL DEFAULT ''"],
['deny_paths', "TEXT NOT NULL DEFAULT ''"],
['merge_method', "TEXT NOT NULL DEFAULT 'squash'"],
['allow_private_models', 'INTEGER NOT NULL DEFAULT 0'],
['require_protection', 'INTEGER NOT NULL DEFAULT 1'],
['stage_mode', "TEXT NOT NULL DEFAULT 'off'"],
['models_dirty', 'INTEGER NOT NULL DEFAULT 0'],
Expand Down
12 changes: 12 additions & 0 deletions test/db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,15 @@ test('repository bot model assignments persist and are cleaned with the selectio
store.close()
}
})

test('the per-user private model permission persists', () => {
const store = new Store(':memory:')
try {
const user = makeUser(store, { login: 'private-permission-user', status: 'approved' })
assert.equal(store.userById(user.id)?.allow_private_models, 0)
store.setUserAllowPrivateModels(user.id, true)
assert.equal(store.userById(user.id)?.allow_private_models, 1)
} finally {
store.close()
}
})
Loading