summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-03-31 16:43:12 +0000
committerRémy Coutable <remy@rymai.me>2016-03-31 16:43:12 +0000
commit95c7aa62defdbc7984c71faeb0b901a7fe59b223 (patch)
treec45ca97bcc7133b06fff9bc10cfc44baf3caf2d7 /app
parent220b51264cf8f032f28a1b85b09de2c85f2e127d (diff)
parentf1d1dc00a93288623a012a933203ed99dc71fed8 (diff)
downloadgitlab-ce-95c7aa62defdbc7984c71faeb0b901a7fe59b223.tar.gz
Merge branch 'fix-todos' into 'master'
Destroy related todos when an Issue/MR is deleted Closes #14550 Closes #14598 See merge request !3376
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/issuable.rb1
-rw-r--r--app/views/dashboard/todos/_todo.html.haml5
2 files changed, 5 insertions, 1 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index cf5b2c71675..47ac22995ab 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -19,6 +19,7 @@ module Issuable
has_many :notes, as: :noteable, dependent: :destroy
has_many :label_links, as: :target, dependent: :destroy
has_many :labels, through: :label_links
+ has_many :todos, as: :target, dependent: :destroy
validates :author, presence: true
validates :title, presence: true, length: { within: 0..255 }
diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml
index 25d2b64e381..aa0aff86d4d 100644
--- a/app/views/dashboard/todos/_todo.html.haml
+++ b/app/views/dashboard/todos/_todo.html.haml
@@ -10,7 +10,10 @@
(removed)
%span.todo-label
= todo_action_name(todo)
- = todo_target_link(todo)
+ - if todo.target
+ = todo_target_link(todo)
+ - else
+ (removed)
&middot; #{time_ago_with_tooltip(todo.created_at)}