-
-
Notifications
You must be signed in to change notification settings - Fork 650
3120 remove URL's from data when they are supposed to be disabled #3121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
fb3795b
ab4cc80
643a743
f659876
a13f6a3
526fa24
12b28ff
418068e
76ab269
7b619e6
7556086
e4d1012
b6f48a9
a70959e
1494df9
3ce40b1
1c1ac25
f0a6fc4
420164d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| // import StatusPage from "../../models/StatusPage.js"; | ||
| // import { NormalizeData } from "../../../utils/dataUtils.js"; | ||
| // import ServiceRegistry from "../../../service/system/serviceRegistry.js"; | ||
| // import StringService from "../../../service/system/stringService.js"; | ||
|
|
||
| const SERVICE_NAME = "statusPageModule"; | ||
|
|
||
| class StatusPageModule { | ||
| constructor({ StatusPage, NormalizeData, stringService }) { | ||
| constructor({ StatusPage, NormalizeData, stringService, AppSettings }) { | ||
| this.StatusPage = StatusPage; | ||
| this.NormalizeData = NormalizeData; | ||
| this.stringService = stringService; | ||
| this.AppSettings = AppSettings; | ||
| } | ||
|
|
||
| createStatusPage = async ({ statusPageData, image, userId, teamId }) => { | ||
|
|
@@ -217,7 +217,7 @@ class StatusPageModule { | |
| showUptimePercentage: 1, | ||
| timezone: 1, | ||
| showAdminLoginLink: 1, | ||
| url: 1, | ||
| url: { $cond: [{ $eq: ["$statusPage.showMonitorUrl", true] }, "$monitors.url", "$$REMOVE"] }, | ||
|
||
| }, | ||
| monitors: { | ||
| _id: 1, | ||
|
|
@@ -260,11 +260,16 @@ class StatusPageModule { | |
|
|
||
| const { statusPage, monitors } = statusPageQuery[0]; | ||
|
|
||
| const appSettings = await this.AppSettings.findOne({ singleton: true }).lean(); | ||
| const showURL = appSettings?.showURL === true; | ||
|
Comment on lines
263
to
264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 | Confidence: High This change adds a database query ( Code Suggestion: // In services.js, inject settingsModule (which already uses AppSettings)
const statusPageModule = new StatusPageModule({ ..., settingsModule });
// In statusPageModule.js constructor
this.settingsModule = settingsModule;
// In getStatusPageByUrl
const showURL = this.settingsModule.getAppSettings()?.showURL === true; |
||
|
|
||
| const normalizedMonitors = monitors.map((monitor) => { | ||
| return { | ||
| ...monitor, | ||
| checks: this.NormalizeData(monitor.checks, 10, 100), | ||
| }; | ||
| const normalizedChecks = this.NormalizeData(monitor.checks, 10, 100); | ||
| if (showURL !== true) { | ||
| const { url, ...rest } = monitor; | ||
| return { ...rest, checks: normalizedChecks }; | ||
| } | ||
|
||
| return { ...monitor, checks: normalizedChecks }; | ||
| }); | ||
|
|
||
| return { statusPage, monitors: normalizedMonitors }; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.