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

fix: disable the Invite Users button until at least one email address has been entered #10136

Conversation

TheSussex
Copy link
Collaborator

@TheSussex TheSussex commented Apr 15, 2024

What

@TheSussex TheSussex requested a review from a team as a code owner April 15, 2024 16:32
@github-actions github-actions bot added 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. labels Apr 15, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.65%. Comparing base (dc04d18) to head (88617e3).
Report is 249 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10136      +/-   ##
==========================================
+ Coverage   49.54%   49.65%   +0.10%     
==========================================
  Files          67       71       +4     
  Lines       20650    20978     +328     
  Branches     4980     5027      +47     
==========================================
+ Hits        10231    10416     +185     
- Misses       9131     9270     +139     
- Partials     1288     1292       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

<p>[% lang('enter_email_addresses_of_users') %]</p>
<textarea id="email_list" name="email_list" style="height:100px;width:50vw"></textarea>
<textarea id="email_list" name="email_list" style="height:100px;width:50vw" oninput="toggleInviteButton()"></textarea>
Copy link
Member

Choose a reason for hiding this comment

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

oninput does not exists in HTML ! Some JS framework provide it but they transform it to an event listener.

The way to do it is to use JQuery, something like:

$(document).ready(function () {
  // observe email entry
  $("#email_list").on("input", function(event) {
    // handle event, eg. toggle Invite button
    // you can get the textarea with event.target
  });
});

see https://api.jquery.com/on/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh okay, I'll check this out. Thanks

Copy link

sonarcloud bot commented Apr 19, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@stephanegigandet stephanegigandet 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!

@stephanegigandet stephanegigandet merged commit 88c92f7 into openfoodfacts:main Apr 19, 2024
12 checks passed
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

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

Great ! Also tested and it works as expected.

john-gom pushed a commit that referenced this pull request May 24, 2024
… has been entered (#10136)

* validate invite users button values

* update validateEmail regex to address the concern of potential denial of service

* handle event with jquery

* fix sonarcloud integrity issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable Invite Users button on organisation page until email address is entered
4 participants