summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-02-16 20:21:24 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-02-20 12:10:26 -0200
commit9da03c45c9e313e8adb170ee9933bd94efbf747c (patch)
treeb4c362ce821f62404f67a3bed723f4edbb1283d3 /app/services
parent49cd19652ade0eb81126caa590461e8340d63d26 (diff)
downloadgitlab-ce-9da03c45c9e313e8adb170ee9933bd94efbf747c.tar.gz
Mark pending tasks for the current user as done when he edit a note
Diffstat (limited to 'app/services')
-rw-r--r--app/services/notes/update_service.rb4
-rw-r--r--app/services/task_service.rb11
2 files changed, 15 insertions, 0 deletions
diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb
index 72e2f78008d..6c2d36546e1 100644
--- a/app/services/notes/update_service.rb
+++ b/app/services/notes/update_service.rb
@@ -7,6 +7,10 @@ module Notes
note.create_new_cross_references!(current_user)
note.reset_events_cache
+ if note.previous_changes.include?('note')
+ TaskService.new.update_note(note, current_user)
+ end
+
note
end
end
diff --git a/app/services/task_service.rb b/app/services/task_service.rb
index e58974a9b38..57f68c61d00 100644
--- a/app/services/task_service.rb
+++ b/app/services/task_service.rb
@@ -54,6 +54,17 @@ class TaskService
end
end
+ # When update a note we should:
+ #
+ # * mark all pending tasks related to the noteable for the current user as done
+ #
+ def update_note(note, current_user)
+ # Skip system notes, like status changes and cross-references
+ unless note.system
+ mark_as_done(note.noteable, current_user)
+ end
+ end
+
private
def create_task(project, target, author, user, action)