A platform for community discussion. Free, open, simple.
FIX: do not show confirmation modal (#31304)
Joffrey JAFFEUX963675c32e17
diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.jsindex dd5ed6e1428..b70b595c472 100644--- a/app/assets/javascripts/discourse/app/controllers/topic.js+++ b/app/assets/javascripts/discourse/app/controllers/topic.js@@ -824,6 +824,10 @@ export default class TopicController extends Controller.extend(@actiondeletePostWithConfirmation(post, opts) {+ if (!post.can_delete) {+ return;+ }+this.dialog.yesNoConfirm({message: i18n("post.confirm_delete"),didConfirm: () => this.send("deletePost", post, opts),diff --git a/spec/system/keyboard_shortcuts_spec.rb b/spec/system/keyboard_shortcuts_spec.rbindex b3bb56b7a14..38558afacac 100644--- a/spec/system/keyboard_shortcuts_spec.rb+++ b/spec/system/keyboard_shortcuts_spec.rb@@ -30,6 +30,26 @@ RSpec.describe "Keyboard shortcuts", type: :system doexpect(page).to have_no_css(".keyboard-shortcuts-modal")end+ describe "<d>" do+ fab!(:post)++ let(:current_user) { Fabricate(:user) }+ let(:topic_page) { PageObjects::Pages::Topic.new }+ let(:dialog) { PageObjects::Components::Dialog.new }++ before { sign_in(current_user) }++ context "when user can't delete the post" do+ it "doesn’t show the confirmation modal" do+ topic_page.visit_topic(post.topic)++ send_keys("j d")++ expect(dialog).to be_closed+ end+ end+ end+describe "<a>" dolet(:current_user) { topic.user }let(:topic_page) { PageObjects::Pages::Topic.new }