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 whitespace validation #1237

Merged
merged 7 commits into from
Jan 25, 2024
Merged

Add whitespace validation #1237

merged 7 commits into from
Jan 25, 2024

Conversation

MadLamprey
Copy link
Contributor

@MadLamprey MadLamprey commented Jan 20, 2024

Summary:

Fixes #1217

Changes Made:

Screenshot 2024-01-21 at 11 49 03 PM
  • Created validator noWhitespace
  • Updated HTML to display error message relating to noWhitespace validation

Proposed Commit Message:

Add validation for title containing only whitespaces

An error message is displayed when user enters only whitespaces but does not provide sufficient information or remedy.

Updating the error message to clearly indicate the problem enhances the user experience.

Let's create a noWhitespace validator to check for title containing only whitespaces.

@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (013fbfa) 53.86% compared to head (478b7d1) 53.82%.

Files Patch % Lines
src/app/core/validators/noWhitespace.validator.ts 50.00% 1 Missing and 1 partial ⚠️
...ase-bug-reporting/new-issue/new-issue.component.ts 50.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1237      +/-   ##
==========================================
- Coverage   53.86%   53.82%   -0.04%     
==========================================
  Files         101      102       +1     
  Lines        2885     2889       +4     
  Branches      534      535       +1     
==========================================
+ Hits         1554     1555       +1     
- Misses        988      989       +1     
- Partials      343      345       +2     

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

Copy link
Contributor

@luminousleek luminousleek left a comment

Choose a reason for hiding this comment

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

Thanks for this! Can you see if it's possible to implement this as an Angular Form Validator. This is so that we can be consistent on how we're validating forms throughout the components since we're already using one to check if the title length exceeds 256 characters.

Also, please update your commit message to follow the guidelines here

Copy link
Contributor

@luminousleek luminousleek left a comment

Choose a reason for hiding this comment

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

Looks good! Minor thing - can you shift the validators directory to under core and not under app? So it'll be /src/core/validators/notWhitespace.validator.ts.

Also please take a screenshot of what the error message looks like, and remember to update the proposed commit message to follow the guidelines linked in my previous review, thanks!

Copy link
Contributor

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

@MadLamprey MadLamprey merged commit fe7be44 into CATcher-org:master Jan 25, 2024
5 checks passed
vigneshsankariyer1234567890 added a commit that referenced this pull request Mar 4, 2024
* Fix broken duplicate link (#1233)

Fix the broken link of a duplicate issue

Currently, the user cannot open the link to a duplicate issue
when opening an issue, as described in #1228.

The links now work as expected.

* Add whitespace validation (#1237)

* Add whitespace validation

* Update whitespace validation for new issue

* Update whitespace validation for title of new issues

* Update whitespace validation for title of new issues

* Move validators into core

* Update import order

---------

Co-authored-by: Misra Aditya <e1096355@u.nus.edu>

* Fix uncaught errors when attempting to access an invalid route

There is an uncaught error when the users click on an invalid internal link in Markdown or enter an invalid link in browser.

Internal links are unlikely to be used for bug reporting and are more likely to be invalid.

Let's show an error toaster and stop the navigation when clicking on an internal link in Markdown. Also, redirect the users to the login page if the users enter invalid link in browser.

* Set default branch to `main`

Previously, image uploads depend on the user's default branch.
Now, we set the branch for image upload to be `main`. Images will 
be uploaded to `main` as a result.

---------

Co-authored-by: Chee Hong <c.h.wong2606@gmail.com>

* Preserve linebreaks (#1241)

With preserving linebreaks, subset list items are rendered as a list,
and paragraph rendering is the same as Github.

* Faulty list view when back navigating (#1243)

Issue table settings such as page index are not 
saved when table is re-mounted.

This behavior inconveniences users as their settings 
are reset everytime they navigate to a specific issue and back.

Let's lift up the table settings of each mounted table to 
a service which the tables pull from when mounted.

* Upgrade to Angular 12 (#1242)

Some of our packages are old and outdated. We should actively maintain 
and keep these packages up-to-date so it is easier to maintain in the 
future.

Let's upgrade to Angular 12 to keep our packages up-to-date.

* Fix markdown blockquote preview difference (#1245)

Due to DOMPurify, the content used for preview is different.
However, given that ngx-markdown already has sufficient sanitation
by default, we remove sanitation by DOMPurify.

* Create release for v3.5.3

---------

Co-authored-by: Nguyen <87511888+nknguyenhc@users.noreply.github.com>
Co-authored-by: AdityaMisra <114080910+MadLamprey@users.noreply.github.com>
Co-authored-by: Misra Aditya <e1096355@u.nus.edu>
Co-authored-by: NereusWB922 <107099783+NereusWB922@users.noreply.github.com>
Co-authored-by: Chee Hong <c.h.wong2606@gmail.com>
Co-authored-by: Arif Khalid <88131400+Arif-Khalid@users.noreply.github.com>
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.

Clearer Error Message for invalid title with whitespaces
3 participants