File tree Expand file tree Collapse file tree 3 files changed +21
-13
lines changed Expand file tree Collapse file tree 3 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,7 @@ export default function ProjectSettingsView() {
123
123
// TODO: Render a generic error screen for when an entity isn't found
124
124
if ( ! project ) return null ;
125
125
126
- const enablePrebuilds =
127
- ! ! project . settings ?. enablePrebuilds ||
128
- // TODO(at): out of scope for now, but once we've migrated the settings of existings projects
129
- // we can remove the implicit enablement here
130
- ! project . settings ;
126
+ const enablePrebuilds = Project . isPrebuildsEnabled ( project ) ;
131
127
132
128
return (
133
129
< ProjectSettingsPage project = { project } >
Original file line number Diff line number Diff line change @@ -55,6 +55,25 @@ export namespace Project {
55
55
return p . name + "-" + p . id ;
56
56
}
57
57
58
+ /**
59
+ * If *no settings* are present on pre-existing projects, this defaults to `true` (enabled) for
60
+ * backwards compatibility. This allows to do any explicit migration of data or adjustment of
61
+ * the default behavior at a later point in time.
62
+ *
63
+ * Otherwise this returns the value of the `enablePrebuilds` settings persisted in the given
64
+ * project.
65
+ */
66
+ export function isPrebuildsEnabled ( project : Project ) : boolean {
67
+ // Defaulting to `true` for backwards compatibility. Ignoring non-boolean for `enablePrebuilds`
68
+ // for evaluation here allows to do any explicit migration of data or adjustment of the default
69
+ // behavior at a later point in time.
70
+ if ( typeof project . settings ?. enablePrebuilds === "undefined" ) {
71
+ return true ;
72
+ }
73
+
74
+ return project . settings . enablePrebuilds ;
75
+ }
76
+
58
77
export interface Overview {
59
78
branches : BranchDetails [ ] ;
60
79
isConsideredInactive ?: boolean ;
Original file line number Diff line number Diff line change @@ -353,14 +353,7 @@ export class PrebuildManager {
353
353
return false ;
354
354
}
355
355
356
- // Defaulting to `true` for backwards compatibility. Ignoring non-boolean for `enablePrebuilds`
357
- // for evaluation here allows to do any explicit migration of data or adjustment of the default
358
- // behavior at a later point in time.
359
- if ( typeof project . settings ?. enablePrebuilds === "undefined" ) {
360
- return true ;
361
- }
362
-
363
- return project . settings . enablePrebuilds ;
356
+ return Project . isPrebuildsEnabled ( project ) ;
364
357
}
365
358
366
359
protected shouldPrebuildIncrementally ( cloneUrl : string , project : Project ) : boolean {
You can’t perform that action at this time.
0 commit comments