diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-11-02 15:51:42 +0100 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-11-06 13:02:50 +0100 |
commit | 906d2f03d1260baac52c0050e60fbc2b87f27400 (patch) | |
tree | 687c1a5771e140f1601dd5d554d288002b03accd /app/controllers/concerns/issuable_actions.rb | |
parent | c791d9cf4af0bd23a7b4d263ce32342f41d3dd44 (diff) | |
download | gitlab-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.rb | 9 |
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 |