aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-host.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index 05f0ef96d..4410e1ff7 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -1,15 +1,19 @@
1import { database as db } from '../server/initializers/database' 1import { database as db } from '../server/initializers/database'
2// import { hasFriends } from '../server/lib/friends' 2import { getServerAccount } from '../server/helpers/utils'
3 3
4db.init(true) 4db.init(true)
5 .then(() => { 5 .then(() => {
6 // FIXME: check if has following 6 return getServerAccount()
7 // return hasFriends()
8 return true
9 }) 7 })
10 .then(itHasFriends => { 8 .then(serverAccount => {
11 if (itHasFriends === true) { 9 return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ])
12 console.log('Cannot update host because you have friends!') 10 })
11 .then(res => {
12 return res.total > 0
13 })
14 .then(hasFollowing => {
15 if (hasFollowing === true) {
16 console.log('Cannot update host because you follow other servers!')
13 process.exit(-1) 17 process.exit(-1)
14 } 18 }
15 19