diff --git a/app/assets/javascripts/questionbox/destroy.coffee b/app/assets/javascripts/questionbox/destroy.coffee index edf69d68..63f590e5 100644 --- a/app/assets/javascripts/questionbox/destroy.coffee +++ b/app/assets/javascripts/questionbox/destroy.coffee @@ -20,7 +20,7 @@ $(document).on "click", "a[data-action=ab-question-destroy]", (ev) -> success: (data, status, jqxhr) -> if data.success if btn[0].dataset.redirect != undefined - window.location.href = btn[0].dataset.redirect + window.location.pathname = btn[0].dataset.redirect else $("div.answerbox[data-q-id=#{qid}], div.questionbox[data-id=#{qid}]").slideUp() showNotification data.message, data.success diff --git a/app/views/question/show.html.haml b/app/views/question/show.html.haml index 14e4bd6b..45b572b0 100644 --- a/app/views/question/show.html.haml +++ b/app/views/question/show.html.haml @@ -13,7 +13,7 @@ %ul.dropdown-menu.dropdown-menu-right{role: :menu} - if current_user.mod? or @question.user == current_user %li.text-danger - %a{href: '#', data: { action: 'ab-question-destroy', q_id: @question.id, redirect: '/' }} + %a{href: '#', data: { action: 'ab-question-destroy', q_id: @question.id, redirect: if @question.author_is_anonymous? then "/" else show_user_questions_path(@question.user.screen_name) end }} %i.fa.fa-trash-o Delete Question - unless @question.user == current_user