Skip to content

Commit

Permalink
Merge pull request #228 from devenv/only_on_new_tasks
Browse files Browse the repository at this point in the history
[notifications] only_on_new_tasks option
  • Loading branch information
ralphbean committed Jul 28, 2015
2 parents 90c81db + b4a67eb commit 89ef3d7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
26 changes: 14 additions & 12 deletions bugwarrior/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def _bool_option(section, option, default):
# Before running CRUD operations, call the pre_import hook(s).
run_hooks(conf, 'pre_import')

notify = _bool_option('notifications', 'notifications', 'False') and not dry_run
notify = _bool_option('notifications', 'notifications', False) and not dry_run

tw = TaskWarriorShellout(
config_filename=get_taskrc_path(conf, main_section),
Expand Down Expand Up @@ -444,17 +444,19 @@ def _bool_option(section, option, default):

# Send notifications
if notify:
send_notification(
dict(
description="New: %d, Changed: %d, Completed: %d" % (
len(issue_updates['new']),
len(issue_updates['changed']),
len(issue_updates['closed'])
)
),
'bw_finished',
conf,
)
only_on_new_tasks = _bool_option('notifications', 'only_on_new_tasks', False)
if not only_on_new_tasks or len(issue_updates['new']) + len(issue_updates['changed']) + len(issue_updates['closed']) > 0:
send_notification(
dict(
description="New: %d, Changed: %d, Completed: %d" % (
len(issue_updates['new']),
len(issue_updates['changed']),
len(issue_updates['closed'])
)
),
'bw_finished',
conf,
)


def build_key_list(targets):
Expand Down
1 change: 1 addition & 0 deletions bugwarrior/docs/common_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ by ``bugwarrior-pull``::
backend = growlnotify
finished_querying_sticky = False
task_crud_sticky = True
only_on_new_tasks = True

Backend options:

Expand Down
1 change: 1 addition & 0 deletions bugwarrior/docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Example Configuration
# backend = growlnotify
# finished_querying_sticky = False
# task_crud_sticky = True
# only_on_new_tasks = True
# This is a github example. It says, "scrape every issue from every repository
Expand Down

0 comments on commit 89ef3d7

Please sign in to comment.