Skip to content

Commit 593714b

Browse files
committed
Homepage Interstitial -> Maintenance Message.
1 parent 8985240 commit 593714b

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

FrontEnd/styles/maintenance.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
// -------------------------------------------------------------------------
16-
// Site maintenance page, set by HOMEPAGE_INTERSTITIAL in the environment.
16+
// Site maintenance page which replaces the home page when enabled.
1717
// -------------------------------------------------------------------------
1818

1919
body.maintenance {
@@ -29,7 +29,7 @@ body.maintenance {
2929
background-position: top center;
3030
background-repeat: no-repeat;
3131
background-size: 40px;
32-
background-image: var(--image-warning);
32+
background-image: var(--image-info);
3333
}
3434
}
3535
}

Sources/App/Core/AppEnvironment.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct AppEnvironment: Sendable {
5959
var gitlabPipelineToken: @Sendable () -> String?
6060
var gitlabPipelineLimit: @Sendable () -> Int
6161
var hideStagingBanner: @Sendable () -> Bool
62-
var homepageInterstitial: @Sendable () -> String?
62+
var maintenanceMessage: @Sendable () -> String?
6363
var httpClient: @Sendable () -> Client
6464
var loadSPIManifest: @Sendable (String) -> SPIManifest.Manifest?
6565
var logger: @Sendable () -> Logger
@@ -195,8 +195,8 @@ extension AppEnvironment {
195195
Environment.get("HIDE_STAGING_BANNER").flatMap(\.asBool)
196196
?? Constants.defaultHideStagingBanner
197197
},
198-
homepageInterstitial: {
199-
Environment.get("HOMEPAGE_INTERSTITIAL").flatMap(\.trimmed)
198+
maintenanceMessage: {
199+
Environment.get("MAINTENANCE_MESSAGE").flatMap(\.trimmed)
200200
},
201201
httpClient: { httpClient },
202202
loadSPIManifest: { path in SPIManifest.Manifest.load(in: path) },

Sources/App/Views/Maintenance/Maintenance+Model.swift renamed to Sources/App/Views/MaintenanceMessage/Maintenance+Model.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import Foundation
1616
import Ink
1717

18-
enum MaintenanceIndex {
18+
enum MaintenanceMessageIndex {
1919

2020
struct Model {
2121

Sources/App/Views/Maintenance/Maintenance+View.swift renamed to Sources/App/Views/MaintenanceMessage/Maintenance+View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import Foundation
1616
import Plot
1717

18-
extension MaintenanceIndex {
18+
extension MaintenanceMessageIndex {
1919

2020
class View: PublicPage {
2121

Sources/App/routes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import VaporToOpenAPI
2323
func routes(_ app: Application) throws {
2424
do { // home page
2525
app.get { req in
26-
if let interstitial = Current.homepageInterstitial() {
27-
let model = MaintenanceIndex.Model(markdown: interstitial)
28-
return MaintenanceIndex.View(path: req.url.path, model: model).document()
26+
if let maintenanceMessage = Current.maintenanceMessage() {
27+
let model = MaintenanceMessageIndex.Model(markdown: maintenanceMessage)
28+
return MaintenanceMessageIndex.View(path: req.url.path, model: model).document()
2929
} else {
3030
let model = try await HomeIndex.Model.query(database: req.db)
3131
return HomeIndex.View(path: req.url.path, model: model).document()

Tests/AppTests/AppEnvironmentTests.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,28 @@ class AppEnvironmentTests: XCTestCase {
2929
XCTAssertEqual(Current.fileManager.checkoutsDirectory(), "/tmp/foo")
3030
}
3131

32-
func test_homepageInterstitial() throws {
33-
defer { unsetenv("HOMEPAGE_INTERSTITIAL") }
34-
Current.homepageInterstitial = AppEnvironment.live.homepageInterstitial
32+
func test_maintenanceMessage() throws {
33+
defer { unsetenv("MAINTENANCE_MESSAGE") }
34+
Current.maintenanceMessage = AppEnvironment.live.maintenanceMessage
3535
do {
36-
unsetenv("HOMEPAGE_INTERSTITIAL")
37-
XCTAssertEqual(Current.homepageInterstitial(), nil)
36+
unsetenv("MAINTENANCE_MESSAGE")
37+
XCTAssertEqual(Current.maintenanceMessage(), nil)
3838
}
3939
do {
40-
setenv("HOMEPAGE_INTERSTITIAL", "foo", 1)
41-
XCTAssertEqual(Current.homepageInterstitial(), "foo")
40+
setenv("MAINTENANCE_MESSAGE", "foo", 1)
41+
XCTAssertEqual(Current.maintenanceMessage(), "foo")
4242
}
4343
do {
44-
setenv("HOMEPAGE_INTERSTITIAL", "", 1)
45-
XCTAssertEqual(Current.homepageInterstitial(), nil)
44+
setenv("MAINTENANCE_MESSAGE", "", 1)
45+
XCTAssertEqual(Current.maintenanceMessage(), nil)
4646
}
4747
do {
48-
setenv("HOMEPAGE_INTERSTITIAL", " ", 1)
49-
XCTAssertEqual(Current.homepageInterstitial(), nil)
48+
setenv("MAINTENANCE_MESSAGE", " ", 1)
49+
XCTAssertEqual(Current.maintenanceMessage(), nil)
5050
}
5151
do {
52-
setenv("HOMEPAGE_INTERSTITIAL", " \t\n ", 1)
53-
XCTAssertEqual(Current.homepageInterstitial(), nil)
52+
setenv("MAINTENANCE_MESSAGE", " \t\n ", 1)
53+
XCTAssertEqual(Current.maintenanceMessage(), nil)
5454
}
5555
}
5656

Tests/AppTests/Mocks/AppEnvironment+mock.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extension AppEnvironment {
6262
gitlabPipelineToken: { nil },
6363
gitlabPipelineLimit: { Constants.defaultGitlabPipelineLimit },
6464
hideStagingBanner: { false },
65-
homepageInterstitial: { nil },
65+
maintenanceMessage: { nil },
6666
httpClient: { httpClient },
6767
loadSPIManifest: { _ in nil },
6868
logger: { logger },

Tests/AppTests/RoutesTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ final class RoutesTests: AppTestCase {
6565
}
6666
}
6767

68-
func test_HomePageInterstitial() throws {
69-
Current.homepageInterstitial = { "HOMEPAGE_INTERSTITIAL" }
68+
func test_maintenanceMessage() throws {
69+
Current.maintenanceMessage = { "MAINTENANCE_MESSAGE" }
7070

7171
try app.test(.GET, "/") { res in
72-
XCTAssertContains(res.body.string, "HOMEPAGE_INTERSTITIAL")
72+
XCTAssertContains(res.body.string, "MAINTENANCE_MESSAGE")
7373
}
7474
}
7575

Tests/AppTests/WebpageSnapshotTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ class WebpageSnapshotTests: SnapshotTestCase {
4848
assertSnapshot(of: page, as: .html)
4949
}
5050

51-
func test_MaintenanceIndexView() throws {
52-
let interstitial = """
51+
func test_MaintenanceMessageIndexView() throws {
52+
let maintenanceMessage = """
5353
# ⚠️ Server Maintenance ⚠️
5454
5555
We are currently performing an update to our database server.
5656
5757
Service should be restored within a few minutes.
5858
"""
5959

60-
let model = MaintenanceIndex.Model(markdown: interstitial)
61-
let page = { MaintenanceIndex.View(path: "/", model: model).document() }
60+
let model = MaintenanceMessageIndex.Model(markdown: maintenanceMessage)
61+
let page = { MaintenanceMessageIndex.View(path: "/", model: model).document() }
6262

6363
assertSnapshot(of: page, as: .html)
6464
}
File renamed without changes.

0 commit comments

Comments
 (0)