Skip to content

Contact form plugin#2191

Merged
yucheng11122017 merged 45 commits intoMarkBind:masterfrom
yucheng11122017:contactFormPlugin
Mar 25, 2023
Merged

Contact form plugin#2191
yucheng11122017 merged 45 commits intoMarkBind:masterfrom
yucheng11122017:contactFormPlugin

Conversation

@yucheng11122017
Copy link
Contributor

@yucheng11122017 yucheng11122017 commented Feb 27, 2023

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Closes #2095

Overview of changes:
Add a web3Form plugin to allow users to create forms which uses the web3Form api

Supports

  • Default Contact Us form
  • Standard inputs (name, email, message, submit button)

Anything you'd like to highlight/discuss:
In terms of number of submissions per month, web 3 form free plan seems to be the best so far with 250 submissions per month. However it only allows one email target vs Formbold with 2 email target but 100 submission / month.
For now, I think web3form offers the best free plan.

Testing instructions:

Proposed commit message: (wrap lines at 72 characters)
Add web 3 form plugin


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

Tested and the form works smoothly for me! Nice implementation 🎉

Mostly nits on documentation!
The form submissions emails ended up in junk/spam for me - not sure if adding a note in the UG on checking spam folders would be suitable?


This plugin allows you to create forms whose response will be sent directly to your email, using the [Web3Form](https://web3forms.com/) API.

To set it up, get an access key from [Web3Forms](https://web3forms.com/). Then add`web3Form` to your site's plugin, and add the `accessKey` parameter via the `pluginsContext`.
Copy link
Contributor

Choose a reason for hiding this comment

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

@yucheng11122017 I assume this access key is not a 'secret' key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Urm not exactly? It's linked to the user's email. web3forms uses it to redirect the form submissions to the user's email.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there potential for misuse of the key? My current understanding is that if someone wants to abuse this key, they could use it to direct the submissions from a different form to the user's email address, but this would have the same effect as simply spamming junk submissions to the original form so it doesn't give a malicious user any additional tool for abuse.
Unless the key can be used to reveal the user's actual email (which the user might have intended to keep private)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be fine, if the key is not meant to be a 'secret' key that should not be made public.

@yucheng11122017
Copy link
Contributor Author

yucheng11122017 commented Mar 2, 2023

Thank you for reviewing the PR @jovyntls :)

The form submissions emails ended up in junk/spam for me - not sure if adding a note in the UG on checking spam folders would be suitable?

I have added a warning to the documentation. Also added a warning that they are limited to 250 submissions per month if they are using the free plan

Copy link
Contributor

@tlylt tlylt left a comment

Choose a reason for hiding this comment

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

Thank you @yucheng11122017 for the PR. Left some comments. Also, I think the suggestions from Jovyn are not yet resolved (FYI, in case you have overlooked them).

@yucheng11122017
Copy link
Contributor Author

image The page nav is corrupted by the example

@tlylt I changed some of the headings to bold instead in 7a149d9. But for the default contact form the heading is <h2> which will be picked up by the page nav. Is that ok?

@tlylt
Copy link
Contributor

tlylt commented Mar 23, 2023

image The page nav is corrupted by the example

@tlylt I changed some of the headings to bold instead in 7a149d9. But for the default contact form the heading is <h2> which will be picked up by the page nav. Is that ok?

Hi @yucheng11122017, I just discussed with @jovyntls, I think if we can change the “contact us" default from h2 to a div with the relevant bootstrap classes to style it, it would prevent the issue from occurring. What do you think about this?

@yucheng11122017
Copy link
Contributor Author

Hi @yucheng11122017, I just discussed with @jovyntls, I think if we can change the “contact us" default from h2 to a div with the relevant bootstrap classes to style it, it would prevent the issue from occurring. What do you think about this?

Yeah ok sounds good! There is nothing that disables the page-nav from rendering some headings right haha

jovyntls
jovyntls previously approved these changes Mar 24, 2023
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks again @yucheng11122017

Yeah ok sounds good! There is nothing that disables the page-nav from rendering some headings right haha

Nope as far as I know! Might be a possible feature request but I don't think there's much utility to doing so (especially since using Bootstrap styles would be a possible quick workaround for authors who wish to do so)

(Edited the PR description to close the original issue with keywords!)

@jovyntls jovyntls added this to the v4.2.0 milestone Mar 24, 2023
@tlylt tlylt dismissed jovyntls’s stale review March 24, 2023 02:40

issue found

@tlylt tlylt removed this from the v4.2.0 milestone Mar 24, 2023
@yucheng11122017
Copy link
Contributor Author

Hi @tlylt, thanks for bringing that up! I changed the selector to only affect the inputs in the web3Form.

tlylt
tlylt previously approved these changes Mar 24, 2023
@tlylt tlylt requested a review from jovyntls March 24, 2023 03:17
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

Didn't catch this earlier (my bad)!

Copy link
Contributor

Choose a reason for hiding this comment

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

One last nit, can we use the newly introduced node types (from #2201 - MbNode, NodeOrText etc) wherever possible instead of cheerio.Element and DomElement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in ac99277! :)

Copy link
Contributor

@tlylt tlylt Mar 24, 2023

Choose a reason for hiding this comment

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

Hi @yucheng11122017, just want to share that besides changing the node type, there might be a need to adjust the code accordingly. So in this case, some of the lines do not make sense anymore:
e.g. these few lines are not needed anymore because attribs will always exist
image

In the future do take note of the general lesson here as well: the review comment may be specific and points out one thing, that doesn't mean other relevant code changes will not be needed. So relooking at what other potential changes are necessary would help a lot.

@jovyntls will make a follow-up update soon, so no need to make further changes here

@tlylt tlylt dismissed their stale review March 24, 2023 03:38

stale

Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

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

LGTM!! 🥳🥳🥳

@jovyntls jovyntls requested a review from tlylt March 24, 2023 07:32
@jovyntls jovyntls added this to the v4.2.0 milestone Mar 24, 2023
Copy link
Contributor

@tlylt tlylt left a comment

Choose a reason for hiding this comment

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

@yucheng11122017 Try merging this (note that this is not typescript PR, so it should be a squash commit strategy)

@yucheng11122017 yucheng11122017 merged commit fa3aca6 into MarkBind:master Mar 25, 2023
@lhw-1 lhw-1 modified the milestones: v4.2.0, v5.0.0 Apr 3, 2023
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

Successfully merging this pull request may close these issues.

Explore integrating contact form as a plugin

5 participants