removed 'No Assignee' option, updated flag saving logic

v1.18.x
Julian Lam 9 years ago
parent 63f147786c
commit 80fe6bde5d

@ -269,14 +269,9 @@ module.exports = function(Posts) {
// Track new additions // Track new additions
for(prop in flagObj) { for(prop in flagObj) {
if (flagObj.hasOwnProperty(prop) && !postData.hasOwnProperty('flag:' + prop)) { if (flagObj.hasOwnProperty(prop) && !postData.hasOwnProperty('flag:' + prop) && flagObj[prop].length) {
changes.push(prop); changes.push(prop);
} }
// Generate changeset for object modification
if (flagObj.hasOwnProperty(prop)) {
changeset['flag:' + prop] = flagObj[prop];
}
} }
// Track changed items // Track changed items
@ -290,6 +285,11 @@ module.exports = function(Posts) {
} }
} }
changeset = changes.reduce(function(memo, prop) {
memo['flag:' + prop] = flagObj[prop];
return memo;
}, {});
// Append changes to history string // Append changes to history string
if (changes.length) { if (changes.length) {
try { try {
@ -323,7 +323,11 @@ module.exports = function(Posts) {
} }
// Save flag data into post hash // Save flag data into post hash
Posts.setPostFields(pid, changeset, callback); if (changes.length) {
Posts.setPostFields(pid, changeset, callback);
} else {
setImmediate(callback);
}
}); });
}; };

@ -134,7 +134,6 @@
<div class="form-group"> <div class="form-group">
<label for="{posts.pid}-assignee">[[topic:flag_manage_assignee]]</label> <label for="{posts.pid}-assignee">[[topic:flag_manage_assignee]]</label>
<select class="form-control" id="{posts.pid}-assignee" name="assignee"> <select class="form-control" id="{posts.pid}-assignee" name="assignee">
<option value="">No Assignee</option>
<!-- BEGIN assignees --> <!-- BEGIN assignees -->
<option value="{assignees.uid}">{assignees.username}</option> <option value="{assignees.uid}">{assignees.username}</option>
<!-- END assignees --> <!-- END assignees -->

Loading…
Cancel
Save