Saving Draft New Topic

Priority: Low

Platform: Discourse mobile iOS (not tested on other platforms). Reproduced in Discourse meta and try.Discourse.org

Description: Save a draft New Topic when prompted. Open Draft button doesn’t work.

Reproducible steps:

  1. Go to Discourse home page.
  2. Click + New Topic
  3. Type in subject line ‘Testing Drafts’. Type in composer body ‘Testing’. Leave as uncategorised.
  4. Click Cancel (bin icon on Discourse mobile). You are asked if you want to Save a draft for later - click that option.
  5. The + New Topic button changes to + Open Draft.
  6. Click + Open Draft. Nothing happens.
  7. Check Drafts folder - no draft is saved.

Consequence: This left me temporarily unable to create a new Topic.

Workaround: Clicking the inactive + Open Draft button a number of times eventually crashes Discourse site in mobile app and returns to domain selection. Return to Discourse - the + Open Draft has cleared and is back to + New Topic.

5 Likes

The title is not lengthy enough to pass this validation

But I wonder, why is the code resolving instead of rejecting and then catching errors?

I think errors can be caught here

something along these lines

this._saveDraftPromise = model.saveDraft().then(() => {
    this._lastDraftSaved = Date.now();
    ...
}, error => {
    // error handling here
}).finally(() => {
    this._saveDraftPromise = null;
});

@eviltrout any thoughts?

6 Likes

This saving code is unfortunately some of our oldest, and often our most fragile. Over the years we’ve layered lots of functionality on it, and some things like saving drafts which can succeed or fail need their own custom functionality which just complicates it even more.

I think your intuition is probably right here, but it’s impossible for me to confirm without seeing how all our tests run. If you have time for a PR in the future that would be great.

5 Likes

Was able to reproduce this bug in MacOS Chrome on Discourse meta following Rhidian’s steps as below:

2 Likes