From: Chocobozzz Date: Fri, 17 Nov 2017 15:24:08 +0000 (+0100) Subject: Fix update host script X-Git-Tag: v0.0.1-alpha~200 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eb8b27c93e61a896a08923dc1ca3c87ba8cf4948;p=oweals%2Fpeertube.git Fix update host script --- 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 @@ 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) }