3 var env = require('gitter-web-env');
4 var logger = env.logger;
5 var GithubRepoService = require('gitter-web-github').GitHubRepoService;
6 var securityDescriptorUpdater = require('gitter-web-permissions/lib/security-descriptor/updater');
9 * Will change a security descriptor to public but
10 * will no longer change it to private when the
11 * change is public->private as there are
12 * edge-cases which are not handled (and difficult to handle)
14 function checkRepoPrivacy(uri) {
15 var repoService = new GithubRepoService();
17 return repoService.getRepo(uri).then(function(repo) {
18 if (repo && !repo.private) {
19 logger.info('GitHub repo is public. Updating security descriptors', {
23 return securityDescriptorUpdater.updatePublicFlagForRepo(uri, true);
26 logger.info('GitHub repo not found. It may either be private or deleting. Ignoring for now', {
32 module.exports = checkRepoPrivacy;