summaryrefslogtreecommitdiff
path: root/app/models/todo.rb
diff options
context:
space:
mode:
authorJarka Kadlecová <jarka@gitlab.com>2018-07-11 18:33:24 +0200
committerJarka Kadlecová <jarka@gitlab.com>2018-07-11 18:33:24 +0200
commit8717c7dad9b5a8fa21ec9a652c54718a6b4c2175 (patch)
treeabedd3ea3e4de67953b992df1a67d7baef8aebe2 /app/models/todo.rb
parentc7c630f142a23505b4adce449c0a176dec142384 (diff)
downloadgitlab-ce-8717c7dad9b5a8fa21ec9a652c54718a6b4c2175.tar.gz
Revert "Merge branch 'ee-5481-epic-todos' into 'master'"
This reverts commit 4d9a3f42f1fd3be21555e19872b7121cca65015e, reversing changes made to ecf9c145f6e4d170cd059df88743393d9e63c489.
Diffstat (limited to 'app/models/todo.rb')
-rw-r--r--app/models/todo.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/models/todo.rb b/app/models/todo.rb
index 942cbb754e3..a2ab405fdbe 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -22,18 +22,15 @@ class Todo < ActiveRecord::Base
belongs_to :author, class_name: "User"
belongs_to :note
belongs_to :project
- belongs_to :group
belongs_to :target, polymorphic: true, touch: true # rubocop:disable Cop/PolymorphicAssociations
belongs_to :user
delegate :name, :email, to: :author, prefix: true, allow_nil: true
- validates :action, :target_type, :user, presence: true
+ validates :action, :project, :target_type, :user, presence: true
validates :author, presence: true
validates :target_id, presence: true, unless: :for_commit?
validates :commit_id, presence: true, if: :for_commit?
- validates :project, presence: true, unless: :group_id
- validates :group, presence: true, unless: :project_id
scope :pending, -> { with_state(:pending) }
scope :done, -> { with_state(:done) }
@@ -47,7 +44,7 @@ class Todo < ActiveRecord::Base
state :done
end
- after_save :keep_around_commit, if: :commit_id
+ after_save :keep_around_commit
class << self
# Priority sorting isn't displayed in the dropdown, because we don't show
@@ -82,10 +79,6 @@ class Todo < ActiveRecord::Base
end
end
- def parent
- project
- end
-
def unmergeable?
action == UNMERGEABLE
end