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

feat: added validation for links in advertisement #1516

Conversation

akhilender-bongirwar
Copy link
Contributor

What kind of change does this PR introduce?
This PR introduces validation of link in the advertisements screen.

Issue Number:

Fixes #1479

Did you add tests for your changes?
Yes

Snapshots/Videos:

2024-01-29.15-36-03.mp4

If relevant, did you update the documentation?
Not relevant

Summary

  • Implemented validation for the formState.link field to ensure that it represents a valid URL.
  • Proper The validation checks have been added to prevent users from submitting arbitrary or invalid strings when creating a new advertisement.
  • Added tests for the modified code.
  • Ensured no other functionality or tests fail after the changes.

Does this PR introduce a breaking change?
No

Other information

Have you read the contributing guide?
Yes

- Implemented validation for the `formState.link` field to ensure that it represents a valid URL.
- Proper The validation checks have been added to prevent users from submitting arbitrary or
  invalid strings when creating a new advertisement.
- Added tests for the modified code.
- Ensured no other functionality or tests fail after the changes.

Signed-off-by: Akhilender <[email protected]>
Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c756a73) 96.23% compared to head (d8ca512) 96.25%.
Report is 11 commits behind head on develop.

❗ Current head d8ca512 differs from pull request most recent head 5a89447. Consider uploading reports for the commit 5a89447 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1516      +/-   ##
===========================================
+ Coverage    96.23%   96.25%   +0.01%     
===========================================
  Files          133      134       +1     
  Lines         3404     3420      +16     
  Branches      1031     1037       +6     
===========================================
+ Hits          3276     3292      +16     
  Misses         123      123              
  Partials         5        5              

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

@Cioppolo14
Copy link
Contributor

@akhilender-bongirwar Please fix the failing test.

@akhilender-bongirwar
Copy link
Contributor Author

@akhilender-bongirwar Please fix the failing test.

The failing tests are not a result of the changes I made. However, the error message Unknown type 'UserToReturn' is peculiar, as there is no type named UserToReturn defined anywhere within the codebase.

@Cioppolo14
Copy link
Contributor

@akhilender-bongirwar Ok, we need to get to the cause of the error, to make sure API & Admin work together. I will ask for help.

@Cioppolo14
Copy link
Contributor

@akhilender-bongirwar UsertoReturn is in the API code base, probably from a recent merge. Please add a reference to it in the src/GraphQl directory tree of the Admin code. See if that clears the error.

@akhilender-bongirwar akhilender-bongirwar force-pushed the feat/add-link-validation branch 2 times, most recently from d8ca512 to 5a89447 Compare January 31, 2024 10:01
@akhilender-bongirwar
Copy link
Contributor Author

akhilender-bongirwar commented Jan 31, 2024

@Cioppolo14 , the failing GraphQL schema introspection workflow is due to the merged PR #1499, where applang was added to the UpdateUserInput input in the schema in admin. However, there are no corresponding changes in talawa-api, which is causing the workflow to fail. But this will get fixed in #1762.

@akhilender-bongirwar
Copy link
Contributor Author

@Cioppolo14 , please add reviewers even for this PR.
Thank you

@akhilender-bongirwar
Copy link
Contributor Author

akhilender-bongirwar commented Feb 3, 2024

@palisadoes please review.

@akhilender-bongirwar
Copy link
Contributor Author

@noman2002 @SiddheshKukade , Kindly review

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

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

LGTM

@palisadoes palisadoes merged commit 85c5534 into PalisadoesFoundation:develop Feb 11, 2024
15 of 17 checks passed
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.

4 participants