mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-12 08:47:40 -05:00
debugged
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -158,6 +158,7 @@ const SystemForm = (props) => {
|
||||
county,
|
||||
country,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
};
|
||||
props.onSubmit(system);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
<Grid columns={2} divided>
|
||||
<Grid.Row>
|
||||
<Grid.Column width={6}>
|
||||
Stuf about what to do
|
||||
<p>The radio systems on OpenMHz are contributed by people from around the world.</p> <p>Use this form to contact the contributer for the <span style={{fontWeight: "bold"}}>{system.name}</span> system regarding:
|
||||
<List as='ul'>
|
||||
<List.Item as='li'>Outages</List.Item>
|
||||
<List.Item as='li'>Audio quality</List.Item>
|
||||
<List.Item as='li'>Talkgroup updates</List.Item>
|
||||
<List.Item as='li'>Thanks & appreciation</List.Item>
|
||||
</List>
|
||||
</p>
|
||||
<p>If you have general questions about OpenMHz send me an email, </p>
|
||||
<p> - Luke <a href="mailto:luke@robotastic.com?Subject=OpenMHz" target="_top">luke@robotastic.com</a> </p>
|
||||
|
||||
</Grid.Column>
|
||||
<Grid.Column width={10}>
|
||||
<Form>
|
||||
|
||||
@@ -95,7 +95,7 @@ function SystemCard (props) {
|
||||
<Grid.Row>
|
||||
<Grid.Column >
|
||||
{system.screenName && <Label size="mini"><Icon name='user' /> {system.screenName}</Label>}
|
||||
<Label size="mini" onClick={handleContactClick}><Icon name='mail' />Mail</Label>
|
||||
{/*system.allowContact && <Label size="mini" onClick={handleContactClick}><Icon name='mail' />Message</Label>*/}
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
<Grid.Row>
|
||||
|
||||
Reference in New Issue
Block a user