forked from lair-framework/browser-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_issues_with_no_hosts.js
More file actions
32 lines (29 loc) · 887 Bytes
/
delete_issues_with_no_hosts.js
File metadata and controls
32 lines (29 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* eslint-disable no-unused-vars */
/* globals Session Issues Meteor */
function deleteIssuesWithNoHosts () {
// Looks at all issues and deletes
// any Issue that has a zero (0) host count.
// Useful if a host was removed from the project
// and left orphaned issues behind.
//
//
// Usage: deleteIssuesNoHosts()
// Created by: Ryan Dorey
// Requires client-side updates: true
var projectId = Session.get('projectId')
var orphanedIssues = Issues.find({
'projectId': projectId,
'hosts': {
$size: 0
}
}).fetch()
if (orphanedIssues.length < 1) {
console.log('No orphaned issues present')
return
}
orphanedIssues.forEach(function (issue) {
console.log('Removing: ' + issue.title)
Meteor.call('removeIssue', projectId, issue._id, function () {})
})
console.log('Total of ' + orphanedIssues.length + ' vuln(s) removed')
}