Skip to content

Commit

Permalink
better clean check
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Apr 20, 2020
1 parent bac12d3 commit 5029ad2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
notes.md

dist/public/uploads

dist/config/app.json
dist/config/config.json

Expand Down
6 changes: 5 additions & 1 deletion api/utils/nodeinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export {nodeinfo}
async function isClean(){
// has owner but with no auth token
const cleanOwner = await models.Contact.findOne({ where: { isOwner: true, authToken: null }})
if(cleanOwner) return true
const msgs = await models.Message.findAll()
const allContacts = await models.Contact.findAll()
const noMsgs = msgs.length===0
const onlyOneContact = allContacts.length===1
if(cleanOwner && noMsgs && onlyOneContact) return true
return false
}
6 changes: 5 additions & 1 deletion dist/api/utils/nodeinfo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/api/utils/nodeinfo.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5029ad2

Please sign in to comment.