From 23c9e8b11ad905ceaa61a3d7e43e064891583461 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 25 2018 09:09:20 +0000 Subject: Add an option to turn off sending email notifications on commits Signed-off-by: Pierre-Yves Chibon --- diff --git a/doc/configuration.rst b/doc/configuration.rst index 7c7afc5..c01bb6d 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1377,6 +1377,19 @@ logged in users. Defaults to: ``['repos', 'myrepos', 'myforks']`` +EMAIL_ON_WATCHCOMMITS +~~~~~~~~~~~~~~~~~~~~~ + +By default pagure sends an email to every one watch commits on a project when a +commit is made. +However some pagure instances may be using a different notification mechanism on +commits and thus may not want this feature to double the notifications received. +This configuration key allows to turn on or off email being sent to people +watching commits on a project upon commits. + +Defaults to: ``True`` + + Deprecated configuration keys ----------------------------- @@ -1410,6 +1423,7 @@ Defaults to: ``3``. This has been replaced by `GITOLITE_BACKEND` in the release 3.0 of pagure. + DOCS_FOLDER, REQUESTS_FOLDER, TICKETS_FOLDER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/pagure/lib/tasks_services.py b/pagure/lib/tasks_services.py index 4273318..c93ab1c 100644 --- a/pagure/lib/tasks_services.py +++ b/pagure/lib/tasks_services.py @@ -189,8 +189,9 @@ def log_commit_send_notifications( session, project, commits, abspath) # Notify subscribed users that there are new commits - pagure.lib.notify.notify_new_commits( - abspath, project, branch, commits) + if pagure_config.get('EMAIL_ON_WATCHCOMMITS', True): + pagure.lib.notify.notify_new_commits( + abspath, project, branch, commits) try: session.commit()