mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:04:53 +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:
@ -128,28 +128,6 @@ RSpec.describe CurrentUserSerializer do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#has_topic_draft" do
|
||||
it "is not included by default" do
|
||||
payload = serializer.as_json
|
||||
expect(payload).not_to have_key(:has_topic_draft)
|
||||
end
|
||||
|
||||
it "returns true when user has a draft" do
|
||||
Draft.set(user, Draft::NEW_TOPIC, 0, "test1")
|
||||
|
||||
payload = serializer.as_json
|
||||
expect(payload[:has_topic_draft]).to eq(true)
|
||||
end
|
||||
|
||||
it "clearing a draft removes has_topic_draft from payload" do
|
||||
sequence = Draft.set(user, Draft::NEW_TOPIC, 0, "test1")
|
||||
Draft.clear(user, Draft::NEW_TOPIC, sequence)
|
||||
|
||||
payload = serializer.as_json
|
||||
expect(payload).not_to have_key(:has_topic_draft)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#can_ignore_users" do
|
||||
let(:guardian) { Guardian.new(user) }
|
||||
let(:payload) { serializer.as_json }
|
||||
|
Reference in New Issue
Block a user