Fix update host script

pull/128/head
Chocobozzz 2017-11-17 16:24:08 +01:00
parent 79d5caf994
commit eb8b27c93e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 11 additions and 7 deletions

View File

@ -1,15 +1,19 @@
import { database as db } from '../server/initializers/database'
// import { hasFriends } from '../server/lib/friends'
import { getServerAccount } from '../server/helpers/utils'
db.init(true)
.then(() => {
// FIXME: check if has following
// return hasFriends()
return true
return getServerAccount()
})
.then(itHasFriends => {
if (itHasFriends === true) {
console.log('Cannot update host because you have friends!')
.then(serverAccount => {
return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ])
})
.then(res => {
return res.total > 0
})
.then(hasFollowing => {
if (hasFollowing === true) {
console.log('Cannot update host because you follow other servers!')
process.exit(-1)
}