Fix scope restoration for promoted scripts
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
listPromotedOverlaysForScope,
|
||||
listVersions,
|
||||
serversMatchingScope,
|
||||
setScope,
|
||||
type ScopeType,
|
||||
type ScriptRow,
|
||||
type ScriptVersionRow
|
||||
@@ -1089,6 +1090,7 @@ export function latestVersionForScript(script: ScriptRow): ScriptVersionRow | nu
|
||||
export function unsetScopeAndDetach(scriptId: number): string[] {
|
||||
const script = getScript(scriptId);
|
||||
if (!script) throw new BetaError(`no such script (id=${scriptId})`, 'no-such-script');
|
||||
setScope({ scriptId, scopeType: null, scopeValue: null });
|
||||
|
||||
const detached: string[] = [];
|
||||
if (script.kind === 'script' || script.kind === 'plugin') {
|
||||
@@ -1104,6 +1106,5 @@ export function unsetScopeAndDetach(scriptId: number): string[] {
|
||||
detached.push(server);
|
||||
}
|
||||
}
|
||||
db().prepare('UPDATE scripts SET scope_type = NULL, scope_value = NULL WHERE id = ?').run(scriptId);
|
||||
return detached;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user