forked from CMU-17313Q/cmu-17313q-f24-nodebb-f24-NodeBB
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Concluding the Resource page Functionality by Displaying the Links - User Story 5 #50
Open
AlAnoud2003
wants to merge
163
commits into
f24
Choose a base branch
from
adding-resources
base: f24
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ntroller functionality
…modifyed test in topics for run time error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Concluded the back-end functionality of the “Resources” page by implementing the code that extracts the links from the user’s posts, directly sending and displaying the link in the “Resources” page.
File’s changed:
- src/posts/create.js: Defined a function titled “extractLinks” that identifies all links (Regex pattern) from the text box (whether as markdown links or plain URL), and then returns a unique list of extracted links. Created a condition which calls on the function with the user’s post content, checks if any links were extracted, and adds the extracted links to two sets: a post-specific set and the general set in the database.
- src/controllers/resources-button.js: Modified the “getResourcesButtonPage” controller function to call on the resources-button API endpoint to retrieve the set of links from the database and cleans the links. The resources-page view is then rendered with a title and the cleaned links in JSON format.
- src/views/resources-button.tpl: Added JavaScript in the template to parse a JSON string containing the extracted links, sorts them, and creates a list item and anchor element for each link to have it displayed and clickable.
Manual testing: Manual testing was conducted through console logging the extracted links from the user’s posts as well as the completed set of links shown in the Resources page.
Commits: Commits and code changes from September 26 up to the commit in October 8 reading “NEW MODIFICATINS - ….” was when I manually copied and pasted @rmmahmou ’s pull-request code in my branch in order to begin my implementation of the user story.
This user story is complete and works fine, however, there are issues when running "npm run test"
While this user story works, this pull request isn't merged into the main branch of the repository as it is failing the tests due to schema errors when running "npm run test".
Resolves issue #46