Fix update host script
This commit is contained in:
parent
79d5caf994
commit
eb8b27c93e
|
@ -1,15 +1,19 @@
|
||||||
import { database as db } from '../server/initializers/database'
|
import { database as db } from '../server/initializers/database'
|
||||||
// import { hasFriends } from '../server/lib/friends'
|
import { getServerAccount } from '../server/helpers/utils'
|
||||||
|
|
||||||
db.init(true)
|
db.init(true)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// FIXME: check if has following
|
return getServerAccount()
|
||||||
// return hasFriends()
|
|
||||||
return true
|
|
||||||
})
|
})
|
||||||
.then(itHasFriends => {
|
.then(serverAccount => {
|
||||||
if (itHasFriends === true) {
|
return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ])
|
||||||
console.log('Cannot update host because you have friends!')
|
})
|
||||||
|
.then(res => {
|
||||||
|
return res.total > 0
|
||||||
|
})
|
||||||
|
.then(hasFollowing => {
|
||||||
|
if (hasFollowing === true) {
|
||||||
|
console.log('Cannot update host because you follow other servers!')
|
||||||
process.exit(-1)
|
process.exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue