mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-10-06 03:46:41 +08:00
Merge pull request #273 from louis-lau/filter-partial-update-fix
Filter partial update fix
This commit is contained in:
commit
961111ad71
5 changed files with 126 additions and 122 deletions
|
@ -6893,7 +6893,7 @@ define({ "api": [
|
||||||
{
|
{
|
||||||
"group": "Parameter",
|
"group": "Parameter",
|
||||||
"type": "Object",
|
"type": "Object",
|
||||||
"optional": false,
|
"optional": true,
|
||||||
"field": "query",
|
"field": "query",
|
||||||
"description": "<p>Rules that a message must match</p>"
|
"description": "<p>Rules that a message must match</p>"
|
||||||
},
|
},
|
||||||
|
@ -6949,7 +6949,7 @@ define({ "api": [
|
||||||
{
|
{
|
||||||
"group": "Parameter",
|
"group": "Parameter",
|
||||||
"type": "Object",
|
"type": "Object",
|
||||||
"optional": false,
|
"optional": true,
|
||||||
"field": "action",
|
"field": "action",
|
||||||
"description": "<p>Action to take with a matching message</p>"
|
"description": "<p>Action to take with a matching message</p>"
|
||||||
},
|
},
|
||||||
|
|
|
@ -6893,7 +6893,7 @@
|
||||||
{
|
{
|
||||||
"group": "Parameter",
|
"group": "Parameter",
|
||||||
"type": "Object",
|
"type": "Object",
|
||||||
"optional": false,
|
"optional": true,
|
||||||
"field": "query",
|
"field": "query",
|
||||||
"description": "<p>Rules that a message must match</p>"
|
"description": "<p>Rules that a message must match</p>"
|
||||||
},
|
},
|
||||||
|
@ -6949,7 +6949,7 @@
|
||||||
{
|
{
|
||||||
"group": "Parameter",
|
"group": "Parameter",
|
||||||
"type": "Object",
|
"type": "Object",
|
||||||
"optional": false,
|
"optional": true,
|
||||||
"field": "action",
|
"field": "action",
|
||||||
"description": "<p>Action to take with a matching message</p>"
|
"description": "<p>Action to take with a matching message</p>"
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@ define({
|
||||||
"apidoc": "0.3.0",
|
"apidoc": "0.3.0",
|
||||||
"generator": {
|
"generator": {
|
||||||
"name": "apidoc",
|
"name": "apidoc",
|
||||||
"time": "2020-10-09T08:07:57.934Z",
|
"time": "2020-10-18T22:35:35.009Z",
|
||||||
"url": "https://apidocjs.com",
|
"url": "https://apidocjs.com",
|
||||||
"version": "0.25.0"
|
"version": "0.25.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"apidoc": "0.3.0",
|
"apidoc": "0.3.0",
|
||||||
"generator": {
|
"generator": {
|
||||||
"name": "apidoc",
|
"name": "apidoc",
|
||||||
"time": "2020-10-09T08:07:57.934Z",
|
"time": "2020-10-18T22:35:35.009Z",
|
||||||
"url": "https://apidocjs.com",
|
"url": "https://apidocjs.com",
|
||||||
"version": "0.25.0"
|
"version": "0.25.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -774,7 +774,7 @@ module.exports = (db, server) => {
|
||||||
* @apiParam {String} user Users unique ID.
|
* @apiParam {String} user Users unique ID.
|
||||||
* @apiParam {String} filter Filters unique ID.
|
* @apiParam {String} filter Filters unique ID.
|
||||||
* @apiParam {String} [name] Name of the Filter
|
* @apiParam {String} [name] Name of the Filter
|
||||||
* @apiParam {Object} query Rules that a message must match
|
* @apiParam {Object} [query] Rules that a message must match
|
||||||
* @apiParam {String} [query.from] Partial match for the From: header (case insensitive)
|
* @apiParam {String} [query.from] Partial match for the From: header (case insensitive)
|
||||||
* @apiParam {String} [query.to] Partial match for the To:/Cc: headers (case insensitive)
|
* @apiParam {String} [query.to] Partial match for the To:/Cc: headers (case insensitive)
|
||||||
* @apiParam {String} [query.subject] Partial match for the Subject: header (case insensitive)
|
* @apiParam {String} [query.subject] Partial match for the Subject: header (case insensitive)
|
||||||
|
@ -782,7 +782,7 @@ module.exports = (db, server) => {
|
||||||
* @apiParam {String} [query.text] Fulltext search against message text
|
* @apiParam {String} [query.text] Fulltext search against message text
|
||||||
* @apiParam {Boolean} [query.ha] Does a message have to have an attachment or not
|
* @apiParam {Boolean} [query.ha] Does a message have to have an attachment or not
|
||||||
* @apiParam {Number} [query.size] Message size in bytes. If the value is a positive number then message needs to be larger, if negative then message needs to be smaller than abs(size) value
|
* @apiParam {Number} [query.size] Message size in bytes. If the value is a positive number then message needs to be larger, if negative then message needs to be smaller than abs(size) value
|
||||||
* @apiParam {Object} action Action to take with a matching message
|
* @apiParam {Object} [action] Action to take with a matching message
|
||||||
* @apiParam {Boolean} [action.seen] If true then mark matching messages as Seen
|
* @apiParam {Boolean} [action.seen] If true then mark matching messages as Seen
|
||||||
* @apiParam {Boolean} [action.flag] If true then mark matching messages as Flagged
|
* @apiParam {Boolean} [action.flag] If true then mark matching messages as Flagged
|
||||||
* @apiParam {Boolean} [action.delete] If true then do not store matching messages
|
* @apiParam {Boolean} [action.delete] If true then do not store matching messages
|
||||||
|
@ -906,6 +906,7 @@ module.exports = (db, server) => {
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.params.query) {
|
||||||
['from', 'to', 'subject', 'listId'].forEach(key => {
|
['from', 'to', 'subject', 'listId'].forEach(key => {
|
||||||
if (result.value.query[key]) {
|
if (result.value.query[key]) {
|
||||||
$set['query.headers.' + key] = result.value.query[key].replace(/\s+/g, ' ');
|
$set['query.headers.' + key] = result.value.query[key].replace(/\s+/g, ' ');
|
||||||
|
@ -940,7 +941,9 @@ module.exports = (db, server) => {
|
||||||
$unset['query.size'] = true;
|
$unset['query.size'] = true;
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.params.action) {
|
||||||
['seen', 'flag', 'delete', 'spam'].forEach(key => {
|
['seen', 'flag', 'delete', 'spam'].forEach(key => {
|
||||||
if (typeof result.value.action[key] === 'boolean') {
|
if (typeof result.value.action[key] === 'boolean') {
|
||||||
$set['action.' + key] = result.value.action[key];
|
$set['action.' + key] = result.value.action[key];
|
||||||
|
@ -1025,10 +1028,11 @@ module.exports = (db, server) => {
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasChanges) {
|
if (!hasChanges) {
|
||||||
res.json({
|
res.json({
|
||||||
error: 'No changes'
|
success: true
|
||||||
});
|
});
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue