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

Chrome: Fix post visbility when saving a post #889

Merged
merged 1 commit into from
May 25, 2017

Conversation

youknowriad
Copy link
Contributor

Posts with a "public" status and a empty string password were being considered "protected" while posts with "public" status and a null or undefined password were being considered "private". This distinction was necessary to allow us to check "password protected" visibility and display an empty password at the same time.

The problem with this is that saving a post automatically fills the password with an empty string which was being considered as password protected.

This fixes the issue by considering all nullable values for the password as "public" posts and introduce a local state in the visibility selector to display the password input even if the password is empty.

@youknowriad youknowriad added General Interface Parts of the UI which don't fall neatly under other labels. [Type] Bug An existing feature does not function as intended labels May 24, 2017
@youknowriad youknowriad self-assigned this May 24, 2017
@youknowriad youknowriad requested review from jasmussen and ellatrix May 24, 2017 12:46
@jasmussen
Copy link
Contributor

Not entirely sure how to test. But I tried setting the post as password protected with an empty password and saving. So long as the password field is empty, the indicator still shows "Public", which I suppose is to be expected. The indicator isn't reset back to "public", though, the radio button still shows "public" as selected:

screen shot 2017-05-24 at 15 07 26

Upon a page reload, this resets to public, though:

screen shot 2017-05-24 at 15 07 35

Both of which I think are probably fine.

Incidentally, the 405 not allowed error is showing up for me on updating a saved post. I can save posts just fine, I just can't update them:

screen shot 2017-05-24 at 15 08 41

I don't think that's a regression in this branch, but I think I told @nylen earlier that I could save and update posts. I could probably always save, but never update posts.

@youknowriad
Copy link
Contributor Author

You're right I forgot to mention that on master, when you save a post, the visibility switches to "password protected" right now and that's what this PR is fixing.

And yes, the behaviour you're seeing is the expected one. The visibility will show "Password Protected" only if you fill the password but the selector allows you to select the "password" radio input to start filling the password (even if the password is empty at first).

@jasmussen
Copy link
Contributor

Sounds good, then 👍 from me.

@youknowriad youknowriad merged commit 6115213 into master May 25, 2017
@youknowriad youknowriad deleted the fix/post-visibility branch May 25, 2017 08:30
@aduth
Copy link
Member

aduth commented May 25, 2017

The logic described in the original pull request text is screaming for tests 😄 (#641)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Interface Parts of the UI which don't fall neatly under other labels. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants