From da9b2019340317ee603416d4c74ecdcfde21d720 Mon Sep 17 00:00:00 2001 From: Farhaan Bukhsh Date: Apr 14 2017 10:32:37 +0000 Subject: Disable pagure ci for private repo --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index ba2ec21..f7770a9 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1132,9 +1132,10 @@ def add_pull_request_comment(session, request, commit, tree_id, filename, })) # Send notification to the CI server, if the comment added was a - # notification and the PR is still open + # notification and the PR is still open and project is not private if notification and request.status == 'Open' \ - and request.project.ci_hook and PAGURE_CI: + and request.project.ci_hook and PAGURE_CI \ + and not request.project.private: REDIS.publish('pagure.ci', json.dumps({ 'ci_type': request.project.ci_hook.ci_type, 'pr': request.to_json(public=True, with_comments=False) @@ -1593,7 +1594,8 @@ def new_pull_request(session, branch_from, ) # Send notification to the CI server - if REDIS and request.project.ci_hook and PAGURE_CI: + if REDIS and request.project.ci_hook and PAGURE_CI \ + and not request.project.private: REDIS.publish('pagure.ci', json.dumps({ 'ci_type': request.project.ci_hook.ci_type, 'pr': request.to_json(public=True, with_comments=False) diff --git a/pagure/ui/plugins.py b/pagure/ui/plugins.py index 48bfc64..cba8fb5 100644 --- a/pagure/ui/plugins.py +++ b/pagure/ui/plugins.py @@ -73,6 +73,9 @@ def view_plugin(repo, plugin, username=None, namespace=None, full=True): 403, 'You are not allowed to change the settings for this project') + if repo.private: + APP.config.get('DISABLED_PLUGINS', []).append('Pagure CI') + if plugin in APP.config.get('DISABLED_PLUGINS', []): flask.abort(404, 'Plugin disabled')