Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft should only be deleted if post is successful. #18

Open
askvortsov1 opened this issue May 25, 2020 · 4 comments
Open

Draft should only be deleted if post is successful. #18

askvortsov1 opened this issue May 25, 2020 · 4 comments

Comments

@askvortsov1
Copy link
Contributor

A PR to core and byobu (and tags) needs to be submitted so that the onsubmit methods of the composers return promises. Then, we can extend that to add a .then, which will allow us to only delete on successful submit.

@dsevillamartin
Copy link
Member

I feel like this kind of logic should be done through the backend. We can easily pass the draft ID in the request, and listening to the Posted and Started events for posts and discussions respectively should do the trick.

@askvortsov1
Copy link
Contributor Author

We'd still need to remove it from the frontend UI, or at least set off a refresh call to the API, which we wouldn't know when to do.

@dsevillamartin
Copy link
Member

dsevillamartin commented Jun 4, 2020

You can just use app.store.remove(draft model) when the submit button is pressed, and actually remove it from DB in the backend event listener. If it errored, a simple refresh would bring it back.

We could also add a timeout and check if the user starts typing again, and there's a connected draft ID, to fetch the store-removed draft and bring it back to the frontend store.

@askvortsov1
Copy link
Contributor Author

actually remove it from DB in the backend event listener

Problem with this is, there's nothing in the sent post linking it to a draft, so we'd need to know which drafts to delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants