diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 0e62ad6..66bfe0b 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -387,6 +387,7 @@ class Project(BASE): 'Enforce_signed-off_commits_in_pull-request': False, 'always_merge': False, 'issues_default_to_private': False, + 'fedmsg_notifications': True, } if self._settings: diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 0c47773..4f6ef18 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -52,7 +52,8 @@ def log(project, topic, msg, redis=None): occuring in pagure. ''' # Send fedmsg notification (if fedmsg is there and set-up) - fedmsg_publish(topic, msg) + if not project or project.settings.get('fedmsg_notifications', True): + fedmsg_publish(topic, msg) if redis and project: redis.publish( diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py index 80b6860..e946395 100644 --- a/tests/test_pagure_lib.py +++ b/tests/test_pagure_lib.py @@ -933,7 +933,8 @@ class PagureLibtests(tests.Modeltests): 'Web-hooks': None, 'Enforce_signed-off_commits_in_pull-request': False, 'always_merge': False, - "issues_default_to_private": False, + 'issues_default_to_private': False, + 'fedmsg_notifications': True, }, user='pingou', ) @@ -950,6 +951,8 @@ class PagureLibtests(tests.Modeltests): 'Minimum_score_to_merge_pull-request': None, 'Web-hooks': '', 'Enforce_signed-off_commits_in_pull-request': False, + 'issues_default_to_private': False, + 'fedmsg_notifications': True, }, user='pingou', ) diff --git a/tests/test_pagure_lib_git.py b/tests/test_pagure_lib_git.py index 27b39d7..b3fc048 100644 --- a/tests/test_pagure_lib_git.py +++ b/tests/test_pagure_lib_git.py @@ -713,7 +713,7 @@ new file mode 100644 index 0000000..60f7480 --- /dev/null +++ b/456 -@@ -0,0 +1,87 @@ +@@ -0,0 +1,89 @@ +{ + "assignee": null, + "branch": "master", @@ -740,6 +740,7 @@ index 0000000..60f7480 + "Only_assignee_can_merge_pull-request": false, + "Web-hooks": null, + "always_merge": false, ++ "fedmsg_notifications": true, + "issue_tracker": true, + "issues_default_to_private": false, + "project_documentation": false, @@ -771,6 +772,7 @@ index 0000000..60f7480 + "Only_assignee_can_merge_pull-request": false, + "Web-hooks": null, + "always_merge": false, ++ "fedmsg_notifications": true, + "issue_tracker": true, + "issues_default_to_private": false, + "project_documentation": false,