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

Make sure an empty draft can't be published #369

Closed
koke opened this issue Dec 13, 2018 · 8 comments · Fixed by #2393 or wordpress-mobile/WordPress-iOS#14329
Closed

Make sure an empty draft can't be published #369

koke opened this issue Dec 13, 2018 · 8 comments · Fixed by #2393 or wordpress-mobile/WordPress-iOS#14329

Comments

@koke
Copy link
Member

koke commented Dec 13, 2018

As reported by @rachelmcr:


I’m able to save a completely empty post (no title or content). That shouldn’t be possible. To reproduce:

  1. Start a new Gutenberg post.
  2. Tap into the post content area. This makes a new paragraph block appear.
  3. Tap the ellipsis menu and select “Save as Draft.”

You can also try to publish an empty post, although it fails. The “Publish” button shouldn’t be enabled in that case:

  1. Start a new Gutenberg post. (You don’t have to enter any content or tap anywhere in the post title or content area.)
  2. Tap the Publish button.

I'm adding this one for the alpha assuming it's a quick fix, since Aztec already behaves that way.

@koke koke added this to the Alpha milestone Dec 13, 2018
@hypest
Copy link
Contributor

hypest commented Dec 13, 2018

Tap into the post content area. This makes a new paragraph block appear.

Hmm, interesting. We'll need to figure out a way to mask out the change introduced by the empty GB paragraph block. The block does sport the GB delimiters and an empty <p></p> set. I'm not too confident this can be done in the Alpha. Can we bump it to the Beta perhaps?

@koke
Copy link
Member Author

koke commented Dec 13, 2018

I hadn't noticed that detail. I'm seeing the same thing both on iOS and Android: when you tap to create a new block, it will have some HTML even if there is no text in it. The post will look empty but it won't have empty content. That first part can go to the beta, we probably need to treat a post with an unmodified block as an empty post, but that's OK for the alpha.

I'd still like to address the second part if it's a quick fix.

@daniloercoli
Copy link
Contributor

daniloercoli commented Dec 14, 2018

I'd still like to address the second part if it's a quick fix.

Are you sure that Aztec already behaves that way?

I just tried to publish and empty post with Aztec on Android, and the Publish button is available on the screen. Once I tapped on it, the "Ready to Publish" dialog appeared, and if I confirm to publish the post the error toast can't publish an empty post was there.

@koke
Copy link
Member Author

koke commented Dec 14, 2018

Interesting, it does on iOS. Let's do it on iOS for the Alpha, since I imagine it'd be easy, and consider the Android part for the beta

@etoledom
Copy link
Contributor

etoledom commented Dec 17, 2018

You can also try to publish an empty post, although it fails. The “Publish” button shouldn’t be enabled in that case:

The problem is that we need to send a signal from JS to Native for every time the post content changes. In that way our GutenbergViewController will know if the content is empty or not to enable/disable the publish button at any given time.

This means that we will need to serialize to HTML on every key stroke or action that modifies the content. Probably we will have to do something of the sort at some point anyway.

We could simplify it to send a signal if the content became empty or not empty to avoid so much extra work, but not sure yet if that would be a workaround.

I can give it a look to be sure about the difficulties, but I believe it is not an easy/quick fix.

@koke
Copy link
Member Author

koke commented Dec 17, 2018

OK, thanks for the explanation, let's move it to the Beta then

@koke koke modified the milestones: Alpha, Beta Dec 17, 2018
@koke
Copy link
Member Author

koke commented Jan 16, 2019

This is actually two separate issues. For the beta let's at least figure out what's not working correctly and re-evaluate.

@diegoreymendez diegoreymendez self-assigned this Jan 16, 2019
@diegoreymendez diegoreymendez removed their assignment Jan 16, 2019
@SergioEstevao SergioEstevao removed this from the Beta milestone May 2, 2020
@hypest
Copy link
Contributor

hypest commented Jun 9, 2020

Verified the issue still happening on WPiOS 15.0.

On WPAndroid (alpha-228) the empty post is not saved as a draft when you exit the editor (by pressing "Back"), and hitting "Publish" shows a Toast with "Can't publish an empty post", both of which are not an issue.

I will change this ticket to "iOS" only, mark is as "Writing flow" and assign it to the Releases&Maintenance squad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment