summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/issuable_actions.rb
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-11-02 15:51:42 +0100
committerJarka Kadlecova <jarka@gitlab.com>2017-11-06 13:02:50 +0100
commit906d2f03d1260baac52c0050e60fbc2b87f27400 (patch)
tree687c1a5771e140f1601dd5d554d288002b03accd /app/controllers/concerns/issuable_actions.rb
parentc791d9cf4af0bd23a7b4d263ce32342f41d3dd44 (diff)
downloadgitlab-ce-906d2f03d1260baac52c0050e60fbc2b87f27400.tar.gz
Refactor issuable destroy action
Diffstat (limited to 'app/controllers/concerns/issuable_actions.rb')
-rw-r--r--app/controllers/concerns/issuable_actions.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index b1ed973d178..9c222549cdc 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -57,12 +57,11 @@ module IssuableActions
def destroy
issuable.destroy
- destroy_method = "destroy_#{issuable.class.name.underscore}".to_sym
- TodoService.new.public_send(destroy_method, issuable, current_user) # rubocop:disable GitlabSecurity/PublicSend
+ TodoService.new.destroy_issuable(issuable, current_user)
name = issuable.human_class_name
flash[:notice] = "The #{name} was successfully deleted."
- index_path = polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable.class])
+ index_path = polymorphic_path([parent, issuable.class])
respond_to do |format|
format.html { redirect_to index_path }
@@ -164,4 +163,8 @@ module IssuableActions
def update_service
raise NotImplementedError
end
+
+ def parent
+ @project || @group
+ end
end