mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-04 03:21:18 +01:00
removed 'No Assignee' option, updated flag saving logic
This commit is contained in:
@@ -269,14 +269,9 @@ module.exports = function(Posts) {
|
||||
|
||||
// Track new additions
|
||||
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);
|
||||
}
|
||||
|
||||
// Generate changeset for object modification
|
||||
if (flagObj.hasOwnProperty(prop)) {
|
||||
changeset['flag:' + prop] = flagObj[prop];
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
if (changes.length) {
|
||||
try {
|
||||
@@ -323,7 +323,11 @@ module.exports = function(Posts) {
|
||||
}
|
||||
|
||||
// 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">
|
||||
<label for="{posts.pid}-assignee">[[topic:flag_manage_assignee]]</label>
|
||||
<select class="form-control" id="{posts.pid}-assignee" name="assignee">
|
||||
<option value="">No Assignee</option>
|
||||
<!-- BEGIN assignees -->
|
||||
<option value="{assignees.uid}">{assignees.username}</option>
|
||||
<!-- END assignees -->
|
||||
|
||||
Reference in New Issue
Block a user