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

Add contact-info view #312

Merged
merged 29 commits into from
Apr 18, 2019
Merged

Add contact-info view #312

merged 29 commits into from
Apr 18, 2019

Conversation

cekk
Copy link
Member

@cekk cekk commented Nov 11, 2018

Seems working good.
The only problem that i have, is with the formData.
I need to pass formData={{ tilesLayoutFieldname: {} }} to avoid some errors in the Form component.

@coveralls
Copy link

coveralls commented Nov 11, 2018

Pull Request Test Coverage Report for Build 2730

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at ?%

Totals Coverage Status
Change from base Build 2726: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls

@@ -80,9 +80,7 @@ exports[`Sharing renders a sharing component 1`] = `
</th>
<th
className=""
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cekk this seems to be unrelated to the contact-info view (same for the translation). Did you do this by purpose or accident?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's unrelated, but i had this broken test and without this change i can't had green lights

@@ -0,0 +1,238 @@
/**
* Login container.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cekk you forgot to amend the comments here. Should be "ContactInfo" not "Login"

<List.Item href="/contact">
<FormattedMessage id="Contact" defaultMessage="Contact" />
<List.Item>
<Link to="contact-info" className="item">
Copy link
Member

@tisto tisto Dec 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cekk Maybe this is our chance here to rename "/contact-info" to something saner. This is a contact form, right? I never understood why we use "info" here. Especially since Plone does not allow you to edit the contact info page as an editor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right.
I had a discussion with @robgietema in Tokyo and we decided to keep "contact-info" for retro-compatibility with the plone environment.
But i'd like to change it in "contact" or "contacts" or whatever.
When we decide the name, i could also fix the typo in the other comment.

P.S.: github didn't emailed me yesterday with this review :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneridagh @robgietema I'd prefer to change "contact-info" to "contact-form" but I won't fight for it. My opinioin is that if we don't change things now in Volto for the better, we never will. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contact-form is fine for me also

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then we also need to change the classname etc to make in consistant.

@cekk
Copy link
Member Author

cekk commented Dec 10, 2018

@tisto did you received some notifications about my replies on your reviews?
Because i didn't get any email from github for yours.

@tisto
Copy link
Member

tisto commented Dec 10, 2018

@cekk yep. Got your comments via email...

* master: (99 commits)
  Back to development
  Prepare for release
  Fix build for projects created with Please specify the project directory:   create-volto-app <project-directory> For example:   create-volto-app my-volto-app Run create-volto-app --help to see all options.
  Back to development
  Prepare for release 1.5.0
  Add support for extending Semantic UI Styling using the semantic theme engine by adding an  file
  Default tile position to center for all the existing tiles
  Upgrade api/ to Plone 5.1.3.
  Update README.md
  Update README.md
  Update README.md
  Fix tests
  Add guards if user enters bad Embed code, and related info (and error) message
  Update changelog
  Add supported browsers disclaimer
  Fix Header scroll in Firefox in case that there are lot of items in the nav
  Update yarn.lock.
  Add changelog and documentation
  Downgrade query-string
  Try downgrade again
  ...
@sneridagh
Copy link
Member

@cekk Just merged latest master into the branch. Overall it LGTM, but one question, I was considering two things:

I know that the last one might be an opt-in, in case you configure it, but still we can warn integrators about the fact if they do not configure one...

/cc @tisto @robgietema @cekk what do you think?

@cekk
Copy link
Member Author

cekk commented Feb 19, 2019

If i remember correctly, i tried it but i couldn't check email config because i needed to call a "private" endpoint: the registry one.
I tried to bypass this thing with a better error handling on plone.restapi.

For captcha field, we need to get the value from registry (from collective.recaptcha), right?

@sneridagh
Copy link
Member

sneridagh commented Feb 28, 2019

@cekk having a Plone add-on only to store a string in the registry, then add a service (and a use an XHR call) to retrieve it, and after that validate it (you should also do from the SSR process to not expose the private token), then talk again to the component to give the ok for the code, seems to me like just too much. I don't think that would be that much use cases like this one, but this kind of decisions are the ones that should avoid in the future and we should take it as a strategic policy.

It's true that we can still do the validation on Plone, then add a service for it, but it's that worthy?

/cc @tisto @robgietema @vangheem @bloodbare what do you think?

Probably I can draft something in the next days implementing the solution that I proposed.

@cekk
Copy link
Member Author

cekk commented Feb 28, 2019

Ok, as I said you're more into Volto than me, so you better know what's the vision/policy about its features ;)

* master: (86 commits)
  Back to development
  Release 1.6.1
  Prepare for release
  Fix regression on position of the add tile button
  Remove debug dangling logging
  Fix post release back to development script, by adding semver.inc helper
  Fix version on back to development manually
  Back to development
  Release 1.6.0
  Fix imports on false merge with master
  Add error log in the SSR console. Fix edit forms with richtext fields coming from SSR.
  Update docs
  Add changelog
  Fix images requests that require API auth using a SSR helper
  Fix not valid <div> tag nested in a <p> tag error on tiles and wysiwyg field
  Re-add width stmt that was deleted by accident.
  Set min-width to flating images.
  Docs polishing, first round
  Set image width in Volto editor to 50% for images that float left/right.
  Force use python3 on mkdocs
  ...
… of the secrets used only in SSR mode for recaptcha feature. Add feature to contact form as first consumer.
@sneridagh
Copy link
Member

@cekk @vangheem ok, first implementation in place.

I added a new tokens stash where the private ones are not exposed to the client bundle (tested and works well).

I added the recaptcha feature to be generic for all <Form> component and API-less dependent via a prop recaptcha.

However, after having all implemented, I realised that the mail endpoint is still not protected "as must be" (something that we have in mind), and we probably require to implement the recaptcha validation on it directly for this special case. @bloodbare told me that Guillotina provides this OOTB :) The problem is that we are in a point were doing changes in Plone core is difficult (since 5.2 is feature freezed), although for plone.restapi things are a bit different we will have to introduce a few dependencies (at least the recaptcha verification library) which I don't know if the FWT will be up to it...

Anyways, I would go with this implementation and leave the endpoint improvement for some of the upcoming sprints. For now it works for all forms if the prop is enabled, which it already a great feature for me. What do you think?

/cc @tisto @bloodbare @robgietema

@sneridagh sneridagh requested review from vangheem and tisto March 2, 2019 16:34
@tisto
Copy link
Member

tisto commented Mar 19, 2019

@sneridagh how would the user add the recaptcha token? Do I need a create-volto-app app to do this? I think we are missing some docs here. Though, maybe we should agree if that's the way to go before putting more effort into it.

@bloodbare @robgietema @vangheem opinions?

@vangheem
Copy link
Member

woah, https://plonerestapi.readthedocs.io/en/latest/email-send.html isn't protected?

Can we just schedule a team call to discuss these issues? I feel like at this point, we need a longer form discussion to get through everything that is going on related to integration.

@sneridagh
Copy link
Member

@vangheem it is, because by default only "Manager" role can send mails. We know that it's not the best solution, but for sure it won't be the last implementation. It's on the list of "things to improve".

@bloodbare told me how you do it in Guillotina, I'm +1 for using the same approach and expand it to use it in "all forms". However, not the best moment to introduce changes into the core :) then there's also the inclusion of a third party tool in the core is also to be considered carefully.

@tisto I was waiting to see if that implementation that I did was good enough, and I was waiting for feedback before documenting it. My idea is to use that approach until we have something better in the back. Also, I was -1 in making the config on the Plone side.

@vangheem
Copy link
Member

Could we schedule a call about this to discuss?

@tisto
Copy link
Member

tisto commented Mar 19, 2019

Yep. Let's do that.

* master: (130 commits)
  Fix not valid css-loader options
  Upgrades
  update css-loader
  Add Origin to allow_headers in CORS settings, otherwise Firefox is not allowing CORS
  Back to development
  Release 2.1.3
  Final cleaning up, polish Makefile
  run build
  Polish
  Fix travis
  Missing Volto build step
  Fix traviiis
  Use xenial everywhere
  Fix travis
  Last fixes
  Back to development
  Release 2.1.2
  Add changelog
  Fix the folder_contents view component bby preventing the SearchableText be empty if you haven't typed anything in the filter fields yet. This is caused by the new ZCatalog in Zope 4.
  WIP
  ...
…entation of the secrets used only in SSR mode for recaptcha feature. Add feature to contact form as first consumer."

This reverts commit f79a244.
@sneridagh
Copy link
Member

@cekk
@robgietema and me had a talk about this yesterday, and some weeks ago I discussed this with @vangheem So we concluded:

  1. We ship this for now in the same shape that Plone currently provides (a non "secure" form) not using any captcha mechanism.
  2. We will investigate and develop a way to do client-server validation, ideally without relying a third party service (Google recaptcha) to do that during the Toulouse and Bonn sprints.

So I would merge it right away.

<List.Item href="/contact">
<FormattedMessage id="Contact" defaultMessage="Contact" />
<List.Item>
<Link to="contact-info" className="item">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contact-form is fine for me also

src/config/NonContentRoutes.jsx Outdated Show resolved Hide resolved
src/components/theme/ContactInfo/ContactInfo.test.jsx Outdated Show resolved Hide resolved
<List.Item href="/contact">
<FormattedMessage id="Contact" defaultMessage="Contact" />
<List.Item>
<Link to="contact-info" className="item">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then we also need to change the classname etc to make in consistant.

@cekk cekk requested a review from robgietema April 18, 2019 14:01
@sneridagh sneridagh merged commit 14d937d into master Apr 18, 2019
@sneridagh sneridagh deleted the cekk_contact_form branch April 18, 2019 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants