feat(events): accept 'TBD' as a valid location
Events are often scheduled before the platform (Zoom link, Slack channel) is chosen. The current workaround is a placeholder URL like "https://us02web.zoom.us/j/TBD", which leaks to the public page as a broken link. Accept the literal "TBD" (case-insensitive) in both the Mongoose validator and the form-side validator. The public detail page renders "Platform TBD" instead of a link when the location matches.
This commit is contained in:
parent
e1d224e260
commit
6fa3e08fe0
3 changed files with 16 additions and 12 deletions
|
|
@ -25,13 +25,14 @@ const eventSchema = new mongoose.Schema({
|
|||
// This will typically be a Slack channel or video conference link
|
||||
validate: {
|
||||
validator: function (v) {
|
||||
// Must be either a valid URL or a Slack channel reference
|
||||
// Accept a URL, a Slack channel, or the literal "TBD" (platform undecided).
|
||||
if (typeof v === "string" && v.trim().toUpperCase() === "TBD") return true;
|
||||
const urlPattern = /^https?:\/\/.+/;
|
||||
const slackPattern = /^#[a-zA-Z0-9-_]+$/;
|
||||
return urlPattern.test(v) || slackPattern.test(v);
|
||||
},
|
||||
message:
|
||||
"Location must be a valid URL (video conference link) or Slack channel (starting with #)",
|
||||
"Location must be a valid URL, Slack channel (starting with #), or 'TBD'",
|
||||
},
|
||||
},
|
||||
isOnline: { type: Boolean, default: true }, // Default to online-first
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue