mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:34:28 +08:00
FEATURE: Multiple Draft Topics (#30790)
Allows users to save multiple topic and personal message drafts, allowing more flexibility around content creation. The "New Topic" button will now always start a fresh topic. Drafts can be resumed from the drafts dropdown menu or using the "My Drafts" link in the sidebar. Since drafts require a unique `draft_key` and `user_id` combination, we have updated the format of the draft key for both topics and personal messages. They will now have a prefix like "new_topic_" or "new_message_" with the timestamp of when the composer was first opened appended.
This commit is contained in:
@ -81,41 +81,17 @@ describe "Composer - discard draft modal", type: :system do
|
||||
it "destroys draft" do
|
||||
visit "/new-topic"
|
||||
|
||||
composer.fill_title("this is a test topic")
|
||||
composer.fill_content("a b c d e f g")
|
||||
|
||||
wait_for(timeout: 5) { Draft.count == 1 }
|
||||
|
||||
composer.close
|
||||
|
||||
expect(discard_draft_modal).to be_open
|
||||
discard_draft_modal.click_save
|
||||
discard_draft_modal.click_discard
|
||||
|
||||
wait_for(timeout: 5) { Draft.last != nil }
|
||||
draft_key = Draft.last.draft_key
|
||||
|
||||
visit "/new-topic"
|
||||
|
||||
expect(dialog).to be_open
|
||||
expect(page).to have_content(I18n.t("js.drafts.abandon.confirm"))
|
||||
dialog.click_danger
|
||||
|
||||
wait_for(timeout: 5) { Draft.find_by(draft_key: draft_key) == nil }
|
||||
end
|
||||
|
||||
it "resumes draft when using /new-message" do
|
||||
visit "/new-message"
|
||||
|
||||
composer.fill_content("a b c d e f g")
|
||||
composer.close
|
||||
|
||||
expect(discard_draft_modal).to be_open
|
||||
discard_draft_modal.click_save
|
||||
|
||||
visit "/new-message"
|
||||
|
||||
expect(dialog).to be_open
|
||||
expect(page).to have_content(I18n.t("js.drafts.abandon.confirm"))
|
||||
dialog.click_button I18n.t("js.drafts.abandon.no_value")
|
||||
|
||||
expect(composer).to be_opened
|
||||
expect(composer).to have_content("a b c d e f g")
|
||||
wait_for(timeout: 5) { Draft.count == 0 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user