mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: properly ban non human users from draft system
Previously we had a partial fix in place where non human users were not allowed draft sequences, this left edges around where non human users asked for drafts yet had none. For example system could already have a few drafts in place. This also removes and extensibility point we added that is not in use
This commit is contained in:
@@ -12,6 +12,22 @@ describe Draft do
|
||||
Fabricate(:post)
|
||||
end
|
||||
|
||||
context 'system user' do
|
||||
it "can not set drafts" do
|
||||
# fake a sequence
|
||||
DraftSequence.create!(user_id: Discourse.system_user.id, draft_key: "abc", sequence: 10)
|
||||
|
||||
seq = Draft.set(Discourse.system_user, "abc", 0, { reply: 'hi' }.to_json)
|
||||
expect(seq).to eq(0)
|
||||
|
||||
draft = Draft.get(Discourse.system_user, "abc", 0)
|
||||
expect(draft).to eq(nil)
|
||||
|
||||
draft = Draft.get(Discourse.system_user, "abc", 1)
|
||||
expect(draft).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
context 'backup_drafts_to_pm_length' do
|
||||
it "correctly backs up drafts to a personal message" do
|
||||
SiteSetting.backup_drafts_to_pm_length = 1
|
||||
|
||||
Reference in New Issue
Block a user