-
-
Notifications
You must be signed in to change notification settings - Fork 234
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: Implemented the logic to force the user to tag at least one repositor… #2007
Conversation
…y if the system detects an empty array of repositories while creating a highlight.
✅ Deploy Preview for oss-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for design-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @shamimbinnur! We're just sorting out the wording and this should be good to merge.
@@ -432,6 +432,12 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E | |||
|
|||
const taggedRepoFullNames = taggedRepoList.map((repo) => `${repo.repoOwner}/${repo.repoName}`); | |||
|
|||
// Check if the user has tagged at least one repo and ask them to tag at least one if they haven't | |||
if (taggedRepoList.length < 1) { | |||
setError("Please tag at least one repo!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wording (blocking): Make it clear why at least one repository needs to be added.
setError("Please tag at least one repo!"); | |
setError("Please add at least one repository associated with your blog post"); |
@BekahHW, any suggestions for better wording?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think this is tricky. I need some clarification first. The problem is that when someone submits a blog post, they are automatically generating a repo, right?
I think the repo should be optional in for blog post highlights. For example, it's still valid to highlight work on something like "A guide to writing documentation." There's not necessarily a repo associated with that. For the blog post mentioned in the issue, I'm not sure what repo I would tag.
Can we conditionally check if the highlight is a blog post, and then leave the input empty unless they put something in there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdougie thoughts on the above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we move forward with this implementation, I think Nick's copy works just change the to your:
"Please add at least one repository associated with your blog post"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point that it needs to be when a blog post is added @BekahHW. Missed that. 😅
@shamimbinnur, we'd need to check that it's a blog post before showing that error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nickytonline, thanks for suggesting the better wording.
Not allowing the user to post a blog without tagging the repo is intentional. As @bdougie's comment here states, "every blog highlight should be linked to a repo."
If no repo is tagged whether automatically or manually an empty array of repos is passed to the backend. However, the backend does not keep it empty; it just splits text from the blog link and creates an invalid repo URL.
Let me be clear, "Does every blog post highlight need to be linked to a repo?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so you're saying from a backend perspective, we have to have a repo listed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy changes and we are good 🍕. Thanks for turning this around
## [1.73.0-beta.4](v1.73.0-beta.3...v1.73.0-beta.4) (2023-10-26) ### 🐛 Bug Fixes * add logic to force the user to tag at least one repository to a highlight ([#2007](#2007)) ([665fbf2](665fbf2))
## [1.73.0-beta.4](v1.73.0-beta.3...v1.73.0-beta.4) (2023-10-26) ### 🐛 Bug Fixes * add logic to force the user to tag at least one repository to a highlight ([#2007](#2007)) ([665fbf2](665fbf2))
## [1.73.0](v1.72.0...v1.73.0) (2023-10-26) ### 🍕 Features * implement improved UX for non-connected users profile ([#1992](#1992)) ([f11160c](f11160c)) ### 🧑💻 Code Refactoring * Improve UX on Create New List page - `/hub/lists/new` ([#1987](#1987)) ([c0fcf7a](c0fcf7a)) ### 🐛 Bug Fixes * add logic to force the user to tag at least one repository to a highlight ([#2007](#2007)) ([665fbf2](665fbf2)) * background color in text-input ([#1998](#1998)) ([1913462](1913462)) * more menu overlap issue on safari ([#1999](#1999)) ([66df010](66df010)) * now the error message in highlight form will alert assistive tech ([#2008](#2008)) ([a0d4b3b](a0d4b3b)) * set border radius for modals in small screens ([#2004](#2004)) ([738c714](738c714)) * show contributors name and company in table ([#2012](#2012)) ([79776a3](79776a3))
Description
This PR adds the logic to force the user to tag at least one repository if the system detects an empty array of repositories while creating a highlight.
The system has the logic to automatically detect repositories from the 'PR' and 'Issue' links and tag them to a highlight. However, for the dev.to blog, the system couldn't detect any related repositories, resulting in an empty array of repositories being passed to the backend. This is why an invalid repository was tagged from the backend.
To fix this issue, I have added logic to require users to manually tag at least one repository if the system detects an empty array of repositories while creating a highlight.
What type of PR is this? (check all applicable)
Related Tickets & Documents
Fixes #1995
Mobile & Desktop Screenshots/Recordings
Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?