diff --git a/admin/server/controllers/systems.js b/admin/server/controllers/systems.js index 6f3e9ee..0eefb52 100644 --- a/admin/server/controllers/systems.js +++ b/admin/server/controllers/systems.js @@ -13,11 +13,11 @@ exports.isLoggedIn = function (req, res, next) { // ------------------------------------------- -exports.listUserSystems = async function (req,res,next) { +exports.listUserSystems = async function (req, res, next) { if (!req.user.admin) { res.status(401); res.json({ success: false, message: "Not Authorized" }); - return; + return; } const users = await User.find({}, "_id email firstName lastName lastLogin"); let list = []; @@ -27,7 +27,7 @@ exports.listUserSystems = async function (req,res,next) { const userId = new mongoose.Types.ObjectId(user._id); const systems = await System.find({ userId: userId }, "name shortName description systemType city state county country lastActive"); - user["systems"] = systems; + user["systems"] = systems; list.push(user); } res.json(list); @@ -36,9 +36,9 @@ exports.listUserSystems = async function (req,res,next) { exports.listAllSystems = async function (req, res, next) { if (!req.user.admin) { - res.status(401); - res.json({ success: false, message: "Not Authorized" }); - return; + res.status(401); + res.json({ success: false, message: "Not Authorized" }); + return; } const systems = await System.find().exec(); @@ -61,6 +61,7 @@ exports.listAllSystems = async function (req, res, next) { userId, key, showScreenName, + allowContact, ignoreUnknownTalkgroup, lastActive, active @@ -76,6 +77,7 @@ exports.listAllSystems = async function (req, res, next) { userId, key, showScreenName, + allowContact, ignoreUnknownTalkgroup, lastActive, active @@ -311,6 +313,8 @@ exports.uniqueShortName = async function (req, res, next) { // ------------------------------------------- +// All the values you want to use here need to be copied over in validateSystem() + exports.updateSystem = async function (req, res, next) { res.locals.system.name = res.locals.name; @@ -375,6 +379,7 @@ exports.validateSystem = async function (req, res, next) { try { res.locals.showScreenName = req.body.showScreenName; res.locals.ignoreUnknownTalkgroup = req.body.ignoreUnknownTalkgroup; + res.locals.allowContact = req.body.allowContact; if (!req.body.name || (req.body.name.length < 2)) { console.error("ERROR: Validate System - req.body.name"); res.status(500) diff --git a/admin/src/System/SystemForm.js b/admin/src/System/SystemForm.js index e02b602..73d29fc 100644 --- a/admin/src/System/SystemForm.js +++ b/admin/src/System/SystemForm.js @@ -158,6 +158,7 @@ const SystemForm = (props) => { county, country, showScreenName, + allowContact, ignoreUnknownTalkgroup }; props.onSubmit(system); diff --git a/backend/controllers/systems.js b/backend/controllers/systems.js index b9f6065..b709124 100644 --- a/backend/controllers/systems.js +++ b/backend/controllers/systems.js @@ -79,10 +79,14 @@ exports.contact_system = async function(req, res) { }); request.then(result => { console.log(`User Comment sent to: ${user.email} for shortName: ${system.shortName}`) + res.json({ + success: true + }); }) .catch(err => { console.error(err.statusCode); console.error(err); + res.status(500); res.json({ success: false, message: err @@ -97,6 +101,7 @@ exports.get_systems = async function (req, res) { let fromDate = new Date(Date.now() - 60 * 60 * 24 * 30 * 1000); const results = await System.find({lastActive: {$gte: fromDate}}).populate('userId', "screenName").catch( err => { console.error("Error - get_systems: " + err.message); + res.status(500); res.json({ success: false, message: err diff --git a/frontend/src/System/ContactModal.js b/frontend/src/System/ContactModal.js index 7363bf8..c606a8e 100644 --- a/frontend/src/System/ContactModal.js +++ b/frontend/src/System/ContactModal.js @@ -3,7 +3,7 @@ import { Modal, Button, Icon, - Label, + List, Form, Grid } from "semantic-ui-react"; @@ -35,7 +35,7 @@ function ContactModal(props) { setName(false); setEmail(false); setMessage(false); - //onClose(); + onClose(); } catch (submitError) { console.error(error) setError(submitError); @@ -55,7 +55,17 @@ function ContactModal(props) { - Stuf about what to do +

The radio systems on OpenMHz are contributed by people from around the world.

Use this form to contact the contributer for the {system.name} system regarding: + + Outages + Audio quality + Talkgroup updates + Thanks & appreciation + +

+

If you have general questions about OpenMHz send me an email,

+

- Luke luke@robotastic.com

+
diff --git a/frontend/src/System/SystemCard.js b/frontend/src/System/SystemCard.js index 79e3051..3504f3d 100644 --- a/frontend/src/System/SystemCard.js +++ b/frontend/src/System/SystemCard.js @@ -95,7 +95,7 @@ function SystemCard (props) { {system.screenName && } - + {/*system.allowContact && */}