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

US9 - Backend functionality for "Resolved" feature #47

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

ilong4rennes
Copy link

@ilong4rennes ilong4rennes commented Oct 3, 2024

Summary

  • Implemented full backend functionality for the "Mark as Resolved" button, covering API routing, controller updates, and database changes.
  • Integrated frontend changes to display the resolved status with badges in the UI.
  • A linter error related to theme dependencies caused GitHub checks to fail, but local tests passed and functionality is confirmed to work. SEE DETAILED EXPLANATION IN THE SECTION BELOW
  • Group TA verified that the linter issue does not impact core functionality.
  • Screenshots and further details are provided below.

What

This pull request introduces the full backend functionality for the new "Mark as Resolved" button, ensuring it interacts smoothly with the system's API, routes, and controllers.

Why

Completes issue #21 and #22, completes user story 9.

How

The implementation covers the following aspects:

  1. Added API Routing: Added new API endpoints for the "resolve" functionality, allowing topics to be marked as resolved or unresolved.
  2. Modifed Controllers: Updated topic controllers to handle the new resolve feature. Logic added to set the isResolved field in the database and trigger relevant events when a topic is marked as resolved or unresolved.
  3. Added Database Field: Updated models to accommodate the resolved field.
  4. Integration with Frontend: Made necessary adjustments to integrate the new backend functionality with the frontend UI, ensuring that when a topic is marked as resolved, it reflects correctly in the user interface with the appropriate badges and status updates.

Screenshot 1: Displaying the "Mark as Resolved" button in the UI

Screen Shot 2024-10-03 at 15 35 31

Screenshot 2: The topic marked as resolved, displaying the badge

Screen Shot 2024-10-03 at 15 38 43 Screen Shot 2024-10-03 at 15 39 03

Screenshot 3: Backend log confirming the status update

Screen Shot 2024-10-03 at 15 44 56

Testing

Automated tests are added in test/topics.js, testing (1) default topic as unresolved and (2) admin(instructor) should be able to mark topic as resolved.

Problems and Explanation

A linter error related to the front-end repository and themes caused the GitHub checks to fail, despite all local tests passing. After a thorough review and investigation, our group TA confirmed that this issue does not affect the core functionality. As demonstrated in the section above, the core functionality is working as expected. In the following section, I will provide a detailed explanation of the issue and its underlying causes.

Local tests passed:

Screen Shot 2024-10-09 at 18 04 29 Screen Shot 2024-10-03 at 15 23 58 Screen Shot 2024-10-03 at 15 28 43 Screen Shot 2024-10-03 at 15 28 55 Screen Shot 2024-10-03 at 15 29 02

Linter issue explanation:

The following error occurred:

Error: ENOENT: no such file or directory, open '/home/runner/work/nodebb-f24-the-turtles/nodebb-f24-the-turtles/node_modules/nodebb-theme-harmony/theme.json'

This was caused by modifying the front-end theme dependency in package.json:

"nodebb-theme-harmony": "file:../nodebb-frontend-f24-the-turtles"

This change links the theme to a local repository (link) where I developed the front-end changes. This error is difficult to avoid because it stems from linking a local repository, which bypasses the usual npm installation process that ensures all necessary files like theme.json are present.

@ilong4rennes ilong4rennes changed the title setup API routes, modify controllers US9 - Full backend functionality for the "Resolved" feature Oct 3, 2024
@ilong4rennes ilong4rennes added this to the Sprint 2 milestone Oct 3, 2024
@ilong4rennes ilong4rennes changed the title US9 - Full backend functionality for the "Resolved" feature US9 - Fully worked backend functionality for the "Resolved" feature Oct 3, 2024
@ilong4rennes ilong4rennes self-assigned this Oct 6, 2024
Copy link

@guanjiecheng guanjiecheng left a comment

Choose a reason for hiding this comment

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

Great work!

Just a stylistic thing, could remove console.logs before pushing code that's ready to be merged in that way when other people pull it they aren't confused about where the logs are coming from - especially if they didn't add them themselves!

@ilong4rennes
Copy link
Author

Just a stylistic thing, could remove console.logs before pushing code that's ready to be merged in that way when other people pull it they aren't confused about where the logs are coming from - especially if they didn't add them themselves!

Thanks for the feedback! I've removed the console.log statements.

@ilong4rennes ilong4rennes merged commit a4b0c50 into f24 Oct 9, 2024
1 check failed
@ilong4rennes ilong4rennes changed the title US9 - Fully worked backend functionality for the "Resolved" feature US9 - Backend functionality for "Resolved" feature Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resolve
Projects
None yet
2 participants