Skip to content

Commit a899875

Browse files
committed
feat: save cid in new topic drafts
1 parent c788aae commit a899875

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

static/lib/composer/drafts.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ define('composer/drafts', function () {
8888
var raw = postContainer.find('textarea').val();
8989
var storage = app.user.uid ? localStorage : sessionStorage;
9090

91+
if (postData.hasOwnProperty('cid') && !postData.save_id.endsWith(':cid:' + postData.cid)) {
92+
// A new cid was selected, the save_id needs updating
93+
drafts.removeDraft(postData.save_id); // First, delete the old draft
94+
postData.save_id = postData.save_id.replace(/cid:\d+$/, 'cid:' + postData.cid); // then create a new save_id
95+
}
96+
9197
if (raw.length || (title && title.length)) {
9298
storage.setItem(postData.save_id, raw);
9399

0 commit comments

Comments
 (0)