mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-12 16:57:39 -05:00
Add support for sending messages
This commit is contained in:
@@ -123,6 +123,7 @@ exports.listSystems = async function (req, res, next) {
|
||||
userId,
|
||||
key,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
}) => ({
|
||||
name,
|
||||
@@ -136,6 +137,7 @@ exports.listSystems = async function (req, res, next) {
|
||||
userId,
|
||||
key,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
}))(obj);
|
||||
if (obj.showScreenName) {
|
||||
@@ -319,6 +321,7 @@ exports.updateSystem = async function (req, res, next) {
|
||||
res.locals.system.description = res.locals.description;
|
||||
res.locals.system.systemType = res.locals.systemType;
|
||||
res.locals.system.showScreenName = res.locals.showScreenName;
|
||||
res.locals.system.allowContact = res.locals.allowContact;
|
||||
res.locals.system.ignoreUnknownTalkgroup = res.locals.ignoreUnknownTalkgroup;
|
||||
|
||||
|
||||
@@ -342,6 +345,7 @@ exports.updateSystem = async function (req, res, next) {
|
||||
userId,
|
||||
key,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
}) => ({
|
||||
name,
|
||||
@@ -355,6 +359,7 @@ exports.updateSystem = async function (req, res, next) {
|
||||
userId,
|
||||
key,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
}))(res.locals.system);
|
||||
returnSys.id = res.locals.system._id;
|
||||
@@ -506,6 +511,7 @@ exports.createSystem = async function (req, res, next) {
|
||||
county,
|
||||
country,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
}) => ({
|
||||
name,
|
||||
@@ -517,6 +523,7 @@ exports.createSystem = async function (req, res, next) {
|
||||
county,
|
||||
country,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup
|
||||
}))(res.locals);
|
||||
system.key = key;
|
||||
@@ -543,6 +550,7 @@ exports.createSystem = async function (req, res, next) {
|
||||
country,
|
||||
userId,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup,
|
||||
key
|
||||
}) => ({
|
||||
@@ -556,6 +564,7 @@ exports.createSystem = async function (req, res, next) {
|
||||
country,
|
||||
userId,
|
||||
showScreenName,
|
||||
allowContact,
|
||||
ignoreUnknownTalkgroup,
|
||||
key
|
||||
}))(newSys);
|
||||
|
||||
@@ -12,6 +12,10 @@ var systemSchema = mongoose.Schema({
|
||||
state: String,
|
||||
description: String,
|
||||
showScreenName: Boolean,
|
||||
allowContact: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
ignoreUnknownTalkgroup : Boolean,
|
||||
active: {type: Boolean, default: false},
|
||||
lastActive: Date,
|
||||
|
||||
@@ -24,6 +24,7 @@ const SystemForm = (props) => {
|
||||
const [county, setCounty] = useState("");
|
||||
const [country, setCountry] = useState("");
|
||||
const [showScreenName, setShowScreenName] = useState(false);
|
||||
const [allowContact, setAllowContact] = useState(true);
|
||||
const [ignoreUnknownTalkgroup, setIgnoreUnknownTalkgroup] = useState(false);
|
||||
const [nameError, setNameError] = useState(false);
|
||||
const [shortNameError, setShortNameError] = useState(false);
|
||||
@@ -45,6 +46,7 @@ const SystemForm = (props) => {
|
||||
setCounty(props.system.county);
|
||||
setCountry(props.system.country);
|
||||
setShowScreenName(props.system.showScreenName);
|
||||
setAllowContact(props.system.allowContact);
|
||||
setIgnoreUnknownTalkgroup(props.system.ignoreUnknownTalkgroup);
|
||||
}
|
||||
}, [props.system, props.isEditing]);
|
||||
@@ -128,6 +130,12 @@ const SystemForm = (props) => {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
const handleAllowContactCheckboxChange = () => {
|
||||
setAllowContact((current) => !current);
|
||||
}
|
||||
|
||||
|
||||
const handleScreenNameCheckboxChange = () => {
|
||||
setShowScreenName((current) => !current);
|
||||
}
|
||||
@@ -272,6 +280,12 @@ const SystemForm = (props) => {
|
||||
checked={showScreenName}
|
||||
label="Display Screen Name in System Listing" />
|
||||
</Form.Field>
|
||||
<Form.Field>
|
||||
<Checkbox
|
||||
onChange={handleAllowContactCheckboxChange}
|
||||
checked={allowContact}
|
||||
label="Allow Users to Contact you via a Web Form. They will not get your email address unless you write them back." />
|
||||
</Form.Field>
|
||||
<Form.Field>
|
||||
<Checkbox
|
||||
onChange={handleTalkgroupCheckboxChange}
|
||||
|
||||
Reference in New Issue
Block a user